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...}

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' ) {

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

Print the row out using print_r() or use var_dump on $row to see what the value is.

Array
(
    [0] => 
    [log_check] => 
)

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

var_dump($row);
returns NULL

I think empty() would be the function of choice here.

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!!

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.