Escyll Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
denny911 Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
Escyll Posted September 25, 2007 Author Share Posted September 25, 2007 No, that isn't solving my problem because I want $row['SOMETHING'] to shown in green letters, not the word LEEG in green letters.But thanks anyway Link to comment Share on other sites More sharing options...
denny911 Posted September 25, 2007 Share Posted September 25, 2007 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 More sharing options...
Escyll Posted September 25, 2007 Author Share Posted September 25, 2007 Wow, thanksI tride many things that way, nothing worked,that worked, thanx Link to comment Share on other sites More sharing options...
denny911 Posted September 25, 2007 Share Posted September 25, 2007 Wow, thanksI tride many things that way, nothing worked,that worked, thanxur 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.