Re: [PHP] Row colors

2001-04-09 Thread Rikul

Something like this could work also:

tr bgcolor="? echo
$row_color=="#cc"?$row_color="#c0c0c0":$row_color="#cc" ?"


- Original Message -
From: "Harshdeep S Jawanda" [EMAIL PROTECTED]
To: "Mike P" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, April 09, 2001 1:11 AM
Subject: Re: [PHP] Row colors


 Hi,

 Just make the modification listed below:

 while ($row = mysql_fetch_row($result))
 {
   $cell_color = ++$i % 2 ? "#C0C0C0" : "#CC";
   echo "TR bgcolor=\"$cell_color\"\n";
   for ($i =1;$imysql_num_fields($result);$i++) {
 echo "td$row[$i]/td";
   }
 }

 Mike P wrote:

  I can change the column sof a table with the following code but how do I
  change the row colors instead.With the columns I have "i" to manipulate
but
  not with rows.
 
  while ($row = mysql_fetch_row($result))
  {{
  echo "TR\n";
  for ($i =1;$imysql_num_fields($result);$i++)
  {$cell_color = "#C0C0C0";
  $i % 2  ? 0: $cell_color = "#CC";
  echo "td bgcolor=\"$cell_color\"$row[$i]/td";
  Thanks
  Mike P
  [EMAIL PROTECTED]
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 Regards,
 Harshdeep Singh Jawanda.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Row colors

2001-04-09 Thread Maxim Maletsky

Here,
just was working on it:


snip
...

   $bgcolor = (($row_count%2)==0) ? ' bgcolor="#DBDBDB"' : '';
   $row_count++;

   echo "TR$bgcolor";

...
/snip



Cheers,


Maxim Maletsky
www.PHPBeginner.com




-Original Message-
From: Rikul [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 09, 2001 6:30 PM
To: Harshdeep S Jawanda; Mike P
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Row colors


Something like this could work also:

tr bgcolor="? echo
$row_color=="#cc"?$row_color="#c0c0c0":$row_color="#cc" ?"


- Original Message -
From: "Harshdeep S Jawanda" [EMAIL PROTECTED]
To: "Mike P" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, April 09, 2001 1:11 AM
Subject: Re: [PHP] Row colors


 Hi,

 Just make the modification listed below:

 while ($row = mysql_fetch_row($result))
 {
   $cell_color = ++$i % 2 ? "#C0C0C0" : "#CC";
   echo "TR bgcolor=\"$cell_color\"\n";
   for ($i =1;$imysql_num_fields($result);$i++) {
 echo "td$row[$i]/td";
   }
 }

 Mike P wrote:

  I can change the column sof a table with the following code but how do I
  change the row colors instead.With the columns I have "i" to manipulate
but
  not with rows.
 
  while ($row = mysql_fetch_row($result))
  {{
  echo "TR\n";
  for ($i =1;$imysql_num_fields($result);$i++)
  {$cell_color = "#C0C0C0";
  $i % 2  ? 0: $cell_color = "#CC";
  echo "td bgcolor=\"$cell_color\"$row[$i]/td";
  Thanks
  Mike P
  [EMAIL PROTECTED]
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 Regards,
 Harshdeep Singh Jawanda.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Row colors

2001-04-09 Thread Jason Stechschulte

On Mon, Apr 09, 2001 at 12:08:10AM +, Mike P wrote:
 I can change the column sof a table with the following code but how do I 
 change the row colors instead.With the columns I have "i" to manipulate but 
 not with rows.
 
 while ($row = mysql_fetch_row($result))
 {{
   echo "TR\n";
   for ($i =1;$imysql_num_fields($result);$i++)

This works for me.
  echo "td ".($i  1 ? "bgcolor=c0c0c0" : "bgcolor=cc")."";
-- 
Jason Stechschulte
[EMAIL PROTECTED]
--
Any false value is gonna be fairly boring in Perl, mathematicians
notwithstanding.
 -- Larry Wall in [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Row colors

2001-04-08 Thread Mike P

I can change the column sof a table with the following code but how do I 
change the row colors instead.With the columns I have "i" to manipulate but 
not with rows.

while ($row = mysql_fetch_row($result))
{{
echo "TR\n";
for ($i =1;$imysql_num_fields($result);$i++)
{$cell_color = "#C0C0C0";
$i % 2  ? 0: $cell_color = "#CC";
echo "td bgcolor=\"$cell_color\"$row[$i]/td";
Thanks 
Mike P
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Row colors

2001-04-08 Thread Joe Stump

tr bgcolor="? $cell_color; ?"

--Joe

On Mon, Apr 09, 2001 at 12:08:10AM +, Mike P wrote:
 I can change the column sof a table with the following code but how do I 
 change the row colors instead.With the columns I have "i" to manipulate but 
 not with rows.
 
 while ($row = mysql_fetch_row($result))
 {{
   echo "TR\n";
   for ($i =1;$imysql_num_fields($result);$i++)
   {$cell_color = "#C0C0C0";
   $i % 2  ? 0: $cell_color = "#CC";
   echo "td bgcolor=\"$cell_color\"$row[$i]/td";
 Thanks 
 Mike P
 [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


/**\
 *Joe Stump - PHP/SQL/HTML Developer  *
 * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net   *
 * "Better to double your money on mediocrity than lose it all on a dream."   * 
\**/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Row colors

2001-04-08 Thread Gfunk

see changes


Gfunk - [EMAIL PROTECTED] - http://www.gfunk007.com/


- Original Message -
From: "Mike P" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 09, 2001 10:08 AM
Subject: [PHP] Row colors


 I can change the column sof a table with the following code but how do I
 change the row colors instead.With the columns I have "i" to manipulate
but
 not with rows.


$rowcount = 0;

 while ($row = mysql_fetch_row($result))
 {{

$rowcount++;

if ($rowcount%2==1)
echo "tr bgcolor=\"blue\"";
else
echo "tr bgcolor=\"white\"";

 for ($i =1;$imysql_num_fields($result);$i++)
 {$cell_color = "#C0C0C0";
 $i % 2  ? 0: $cell_color = "#CC";
 echo "td bgcolor=\"$cell_color\"$row[$i]/td";
 Thanks
 Mike P
 [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Row colors

2001-04-08 Thread Joe Stump

Oh well ... 

?

  function bg_color()
  {
global $bg;

if(++$bg % 2 == 0)
  return '#cc';
else
  return '#ee';
  }

  // sql stuff ...
  while($row = mysql_fetch_array($result)
  {
echo 'tr bgcolor="'.bg_color().'"'."\n";
// td's 
echo '/tr';
  }
?


On Sun, Apr 08, 2001 at 08:37:26PM -0400, Mike P wrote:
 That does not change every other row.
 
 -Original Message-
 From: Joe Stump [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, April 08, 2001 8:11 PM
 To: Mike P
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Row colors
 
 
 tr bgcolor="? $cell_color; ?"
 
 --Joe
 
 On Mon, Apr 09, 2001 at 12:08:10AM +, Mike P wrote:
  I can change the column sof a table with the following code but how do I
  change the row colors instead.With the columns I have "i" to manipulate
 but
  not with rows.
 
  while ($row = mysql_fetch_row($result))
  {{
  echo "TR\n";
  for ($i =1;$imysql_num_fields($result);$i++)
  {$cell_color = "#C0C0C0";
  $i % 2  ? 0: $cell_color = "#CC";
  echo "td bgcolor=\"$cell_color\"$row[$i]/td";
  Thanks
  Mike P
  [EMAIL PROTECTED]
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 /***
 ***\
  *Joe Stump - PHP/SQL/HTML Developer
 *
  * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net
 *
  * "Better to double your money on mediocrity than lose it all on a dream."
 *
 \***
 ***/


/**\
 *Joe Stump - PHP/SQL/HTML Developer  *
 * http://www.care2.com - http://www.miester.org - http://gtk.php-coder.net   *
 * "Better to double your money on mediocrity than lose it all on a dream."   * 
\**/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Row colors

2001-04-08 Thread Manuel Lemos

Hello Mike,

On 08-Apr-01 21:08:17, you wrote:

I can change the column sof a table with the following code but how do I 
change the row colors instead.With the columns I have "i" to manipulate but 
not with rows.

while ($row = mysql_fetch_row($result))
{{
   echo "TR\n";
   for ($i =1;$imysql_num_fields($result);$i++)
   {$cell_color = "#C0C0C0";
   $i % 2  ? 0: $cell_color = "#CC";
   echo "td bgcolor=\"$cell_color\"$row[$i]/td";

What you need to do is very simple.  Just echo the TR inside your
for loop and make it BGCOLOR attribute change according to the row number.

While you are at it, maybe you would like to try this PHP table listing
class that not only lets you iterate and change colors for each row but it
also lets you change the highlighting color that the row will have when the
mouse is over them.

http://phpclasses.UpperDesign.com/browse.html/package/120


For display database query results, you may want to try this PHP class
based on the previous that is also able to display links to go between any
pages that the results may be split.

http://phpclasses.UpperDesign.com/browse.html/package/130



Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
--
E-mail: [EMAIL PROTECTED]
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Row colors

2001-04-08 Thread Harshdeep S Jawanda

Hi,

Just make the modification listed below:

while ($row = mysql_fetch_row($result))
{
  $cell_color = ++$i % 2 ? "#C0C0C0" : "#CC";
  echo "TR bgcolor=\"$cell_color\"\n";
  for ($i =1;$imysql_num_fields($result);$i++) {
echo "td$row[$i]/td";
  }
}

Mike P wrote:

 I can change the column sof a table with the following code but how do I
 change the row colors instead.With the columns I have "i" to manipulate but
 not with rows.

 while ($row = mysql_fetch_row($result))
 {{
 echo "TR\n";
 for ($i =1;$imysql_num_fields($result);$i++)
 {$cell_color = "#C0C0C0";
 $i % 2  ? 0: $cell_color = "#CC";
 echo "td bgcolor=\"$cell_color\"$row[$i]/td";
 Thanks
 Mike P
 [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
Regards,
Harshdeep Singh Jawanda.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]