Hopefully this is a simple problem:
I have a while statement in my php code that prints out the rows from a mysql database. This works fine.
My question is: can I use an IF statement within the while statement that doesn't effect all of the results. e.g.PHP Code:while($info = mysql_fetch_array( $result ))
{
print "<div>" . $info['tablerow'] . "</div>";
}
PHP Code:while($info = mysql_fetch_array( $result ))
{
if ($info['anothertablerow'] == true)
{
print "This text is printed only for rows with a value";
}
else
{
print " ";
}
print "<div>" . $info['tablerow'] . "</div>";
}



Reply With Quote


Bookmarks