Jump to content


Simple question


2 replies to this topic

#1 Squid

    Young Padawan

  • Members
  • Pip
  • 132 posts
  • Location:Netherlands
  • Interests:Webdesign, php coding, visual basic programming

Posted 09 November 2005 - 03:25 PM

I've been looking and searching for an answer to my simple php question. But I haven't been able to find anything untill now. What I have it, a list of items selected from a database. Now, I want each line to have a different background color, so it's easy to see which items are linked to others, if you know what I mean. Little example:

$status=mysql_result($result,$i,"status");

The above code fetches/selects the data from the database. The code below displays it on a webpage:

<td valign=\"top\" width=\"10%\">$status</td>

Now, if for example I have 3 items stored in the database:

Item 1
Item 2
Item 3
item 4

I want item 1 and item 3 to have a white background color, and item 2 and 4 a black background color. Would I be able to do this and if so, could you help me on my way?

Many thanks in advance!

~Squiddy

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 09 November 2005 - 04:14 PM

If i understand your question right, you didn't look to hard.
http://www.pixel2life.com/tutorials/PHP_Co...&c=1&d=1&ss=row
Alternating row colors, right?

#3 Squid

    Young Padawan

  • Members
  • Pip
  • 132 posts
  • Location:Netherlands
  • Interests:Webdesign, php coding, visual basic programming

Posted 09 November 2005 - 04:31 PM

rc69, on Nov 9 2005, 09:14 PM, said:

If i understand your question right, you didn't look to hard.
http://www.pixel2life.com/tutorials/PHP_Co...&c=1&d=1&ss=row
Alternating row colors, right?
Thanks a lot, this helps a bunch!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users