0

I have been trying to use the function is_null to see if a database value is NULL. When I run this I am looking at the database and the value is definitely NULL, but it is not re-directing to the error.php page.
What have I done wrong??
Thanks Guys :-)

$sql = "
	SELECT log_check 
	FROM users 
	WHERE user_ID= '$user_ID'":
        $perform = mysql_query($sql);
	if(mysql_num_rows($perform)==1)//if the details are found
		{
		$row = mysql_fetch_array($perform);
		if(is_null($row['log_check']))
			{
			header("Location: ../error.php?error=14");
			exit();
			}
		else
			{ etc...}
2
Contributors
8
Replies
10
Views
8 Years
Discussion Span
Last Post by somedude3488
0

I doubt that a null value in the database is the same a null in php. Most likely its returning as a string which can be checked like this:

if ( $row['log_check'] == 'NULL' ) {
0

That was what I thought originally, but that isn't working either. :-(

0

OK so that last one was from print_r() var_dump has given much better results:

var_dump($row);
returns NULL

0

I have tried it on a new blank page, and it is working, but I cannot get it to work on the original page I was writing....I have even copied and pasted the text from the working one to the original one, but it still won't work on the original. I am very confused!!

0

I have never had a problem like that before, so can't really help there.

Usually when things like that happen I recode everything in which usually fixes the problem. Its always some simple thing I didn't think about earlier.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.