dealing with MySQL NULL's
Posted: Wed Jul 21, 2010 11:25 am
I have a script that passes data from a MySQL query into a <Table>, but periodically some of the MySQL rows contain NULL values. When put in the Table they appear as blank spaces, so I thought if I could test for them I could replace them with a   in order to create a valid <td> entry.
But so far all I am getting is a parse error.
What I came up with is:
but it doesn't work. Is there a way of making this work?
But so far all I am getting is a parse error.
What I came up with is:
Code: Select all
foreach ($row as $attribute)
if ( $attribute is_null )
{ print "<td> " ;
print "\n";
print "<br/></td>";
} else {
print "<td>{$attribute} " ;
print "\n";
print "<br/></td>";
}