Jump to content


Photo

change php table color


  • Please log in to reply
1 reply to this topic

#1 markc1822

markc1822

    Young Padawan

  • Members
  • Pip
  • 33 posts
  • Gender:Male
  • Location:New York

Posted 19 June 2011 - 03:54 PM

Hi how are you guys.

I have a problem i hope someone can help me with.

I created a database with one table. which contains 3 fields

Subject
Grade
Category

i am trying to change the Grade table color if the value is less than 3. I am not sure where to start,

Mark

Attached Files

  • Attached File  pic1.jpg   19.76KB   3 downloads


#2 AndyMills

AndyMills

    Young Padawan

  • Members
  • Pip
  • 26 posts
  • Gender:Male
  • Location:United Kingdom

Posted 11 August 2011 - 05:52 AM

Could you post the code you use to draw the table? The basic principle would be to add an if statement when drawing the table row, for example (using PHP here)


<?php

if ($Grade < 3) {

 echo '<tr style="background-color: #F00"'>;

 } else { 

echo '<tr>';

?>

... (rest of code for drawing table)


Edited by AndyMills, 11 August 2011 - 05:52 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users