working with null in php
Posted: Wed Feb 08, 2012 2:47 pm
I have three fields in a table.
the last field does not always have data in it.
I want to display only the rows where the third field is empty ( or NULL )
I am trying to generate a list of those records that are missing data from field3.
Any thoughts?
the last field does not always have data in it.
I want to display only the rows where the third field is empty ( or NULL )
Code: Select all
//connection strings
$result = mysql_query("SELECT field1, field2, field3 FROM tablename WHERE field3 IS NULL");
while($row = mysql_fetch_array($result))
{
echo $row['field1'] . $row['field2'];
echo "<hr></hr>";
}
//close connection
Any thoughts?