Jump to content

PHP Color


Escyll

Recommended Posts

Hi,I have a little problem and I hope the solution is easy :)Now i have something like this: (It's in an HTML table)$result = mysql_query("SELECT * FROM leerling");while($row = mysql_fetch_array($result)) {print "<td>"; if ($row['SOMETHING']=="leeg") { print "<font color='#FF0000'>Leeg</font>" . "</td>"; } else { echo $row['Something'] . "</td>"; <-- Now THIS line has to be green colored, now its black, if i do it } the way above, you wont see anything. }Who can help me?

Link to comment
Share on other sites

Hi,I have a little problem and I hope the solution is easy :)Now i have something like this: (It's in an HTML table)$result = mysql_query("SELECT * FROM leerling");while($row = mysql_fetch_array($result)) {print "<td>"; if ($row['SOMETHING']=="leeg") { print "<font color='#FF0000'>Leeg</font>" . "</td>"; } else { echo $row['Something'] . "</td>"; <-- Now THIS line has to be green colored, now its black, if i do it } the way above, you wont see anything. }Who can help me?
try this:
while ... {print "<td>";if($row['SOMETHING'] == "leeg") {   print "<font color='#FF0000'>Leeg</font>";   }else ($row['SOMETHING'] != "leeg") {   print "<font color='green'>Leeg</font>";   }print "</td>";} // this is closing bracket for WHILE

Link to comment
Share on other sites

try this:
while ... {print "<td>";if($row['SOMETHING'] == "leeg") {   print "<font color='#FF0000'>Leeg</font>";   }else ($row['SOMETHING'] != "leeg") {   print "<font color='green'>Leeg</font>";   }print "</td>";} // this is closing bracket for WHILE

well, this might work (change only else statement):else ($row['SOMETHING'] != "leeg") { print "<font color='green'>" . $row['SOMETHING'] . "</font>"; }
Link to comment
Share on other sites

Wow, thanksI tride many things that way, nothing worked,that worked, thanx
ur welcome, mani think it would work even without this "($row['SOMETHING'] != "leeg")" in the ELSE statement, so if u want your code to be simpler, just remove it.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...