I know I’m just making a simple error here. I have a column called ParentEventID that sometimes has a NULL value. I need to retrieve rows with that value. My code is only retrieving rows where ParentEventID = “0” right now.
$UserID = "118";
$query = "SELECT * FROM events WHERE UserID='$UserID' AND ParentEventID = 'NULL'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
echo $row['UserID'] . " ".$row['EventName']. " " . $row['ParentEventID'];
echo "<br />";
}
Thanks for the help!
you want to use
IS NULLinstead of= 'NULL'