RE: [PHP] Returning Rows Question

2002-09-04 Thread Mike richardson


While(  ) {   
   ...

   $color = ($color == FF)? EAEAEA : FF;
   print td bgcolor='#$color'\n;

   ...
}

-Original Message-
From: Christopher J. Crane [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, September 04, 2002 3:56 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Returning Rows Question


How do you alternate colors of the rows in a table inside a while
statement when dealing with the output of data from a DB. I am sure it's
something simple but I keep getting into some really long math thing...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Returning Rows Question

2002-09-04 Thread Christopher J. Crane

Thanks. I will give it a shot. I have never seen anything written like that.
Can you give me a brief explanation of what it means?

Thanks again.
- Original Message -
From: Mike richardson [EMAIL PROTECTED]
To: 'Christopher J. Crane' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, September 04, 2002 7:03 PM
Subject: RE: [PHP] Returning Rows Question



 While(  ) {
...

$color = ($color == FF)? EAEAEA : FF;
print td bgcolor='#$color'\n;

...
 }

 -Original Message-
 From: Christopher J. Crane [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 04, 2002 3:56 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Returning Rows Question


 How do you alternate colors of the rows in a table inside a while
 statement when dealing with the output of data from a DB. I am sure it's
 something simple but I keep getting into some really long math thing...



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php











-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Returning Rows Question

2002-09-04 Thread Ashley M. Kirchner

Christopher J. Crane wrote:

 $color = ($color == FF)? EAEAEA : FF;

 Break it down:

 $color = whatever  (we don't care right now)

 That whatever is:  ($color == FF)? EAEAEA : FF

 And that says:  Evaluate the (current) variable $color.

 Is it FF?  if so, change it to EAEAEA, otherwise make it FF

 $color == FF ? (yes) change to EAEAEA : (no) make it FF

--
W | I haven't lost my mind; it's backed up on tape somewhere.
  +
  Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
  IT Director / SysAdmin / WebSmith . 800.441.3873 x130
  Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
  http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Returning Rows Question

2002-09-04 Thread Christopher J. Crane

That's what I thought it meant but I have never seen it writte nthat way.
Thank you very much
- Original Message -
From: Ashley M. Kirchner [EMAIL PROTECTED]
To: Christopher J. Crane [EMAIL PROTECTED]
Cc: Mike richardson [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, September 04, 2002 7:10 PM
Subject: Re: [PHP] Returning Rows Question


 Christopher J. Crane wrote:

  $color = ($color == FF)? EAEAEA : FF;

  Break it down:

  $color = whatever  (we don't care right now)

  That whatever is:  ($color == FF)? EAEAEA : FF

  And that says:  Evaluate the (current) variable $color.

  Is it FF?  if so, change it to EAEAEA, otherwise make it FF

  $color == FF ? (yes) change to EAEAEA : (no) make it FF

 --
 W | I haven't lost my mind; it's backed up on tape somewhere.
   +
   Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410 x130
   IT Director / SysAdmin / WebSmith . 800.441.3873 x130
   Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave. #6
   http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.











-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Returning Rows Question

2002-09-04 Thread David Freeman


  How do you alternate colors of the rows in a table inside a 
  while statement
  when dealing with the output of data from a DB. I am sure 
  it's something
  simple but I keep getting into some really long math thing...

For two alternating colours I normally do something like this:

$use_col = #00FF00;

While (some = condition)
{
  echo using $use_col;
  if ($use_col == #00FF00)
  {
$use_col = #FF;
  } else {
$use_col = #00FF00;
  }
}

Basically, set a colour to use, then in your while loop you see if it is
one of the colour, if it is change it to the other.  If it isn't the
colour you tested for then it's already the other colour so change it
back.

CYA, Dave




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php