Jump to content


displaying mysql rows with different background colors?


3 replies to this topic

#1 Macintosh

    Young Padawan

  • Members
  • Pip
  • 28 posts

Posted 02 April 2007 - 01:47 AM

My question is related to some design ie. css. I want to print some rows of database, in such way that i want even rows have different background color and odd row numbers have different background colors.. could someone tell i could do it.
Thanks.

#2 curthard89

    Young Padawan

  • Members
  • Pip
  • 226 posts

Posted 02 April 2007 - 02:13 AM

above the mysql while statment put

$oddeven = "#DDDDDD"; changing colour to what you want

then put while statment in

whileblablabala

then inside the while statment at the bottom put

then when you print a row, if you use divs fir instance, u would put
echo"
<div style=\"background: $oddeven\">".$rows['sumthing']."</div>

";


if($oddeven == '#DDDDDD'){
$oddeven = "#EEEEEE";
} else {
$oddeven = "#DDDDDD";
}

close the while statment here

Edited by curthard89, 02 April 2007 - 02:16 AM.


#3 _*Creative Insanity_*

  • Guests

Posted 02 April 2007 - 02:17 AM

If you are using DW there is a free extension that does that.
http://www.technocur...hp?fn=downloads

#4 curthard89

    Young Padawan

  • Members
  • Pip
  • 226 posts

Posted 02 April 2007 - 02:19 AM

kool, i use textwrangler, nice free app for a mac, color codes and stuff,

pretty much plain text editor but hey, mac g5's are so lush ;)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users