Page 1 of 1

Null value checking

Posted: Wed Oct 12, 2005 10:16 am
by mhouldridge
Hi,

I am trying to do an if statement as follows to check for a null value within my table under column asset;

Code: Select all

$row2 = $row['asset']; //set $row2 value of $row asset
	if ($row2 == ""){
	}
	else{
	$querytwo = mysql_query("SELECT * FROM ip where asset = $row2"); // Query database with $row2 value
	$ip = mysql_fetch_array($querytwo); // get result from database and assign as $ip
	}
This is not working. Does anybody know how to check for a null value?

Posted: Wed Oct 12, 2005 10:22 am
by mhouldridge
Ive sorted it with;

Code: Select all

$row2 = $row['asset']; //set $row2 value of $row asset
	if ($row2 == ""){
	$ip['ip'] = "";
	}
	else{
	$querytwo = mysql_query("SELECT * FROM ip where asset = $row2"); // Query database with $row2 value
	$ip = mysql_fetch_array($querytwo); // get result from database and assign as $ip
	}