| | |
Trouble with is_null()
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2008
Posts: 62
Reputation:
Solved Threads: 6
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 :-)
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:
PHP Syntax (Toggle Plain Text)
if ( $row['log_check'] == 'NULL' ) {
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Print the row out using print_r() or use var_dump on $row['log_check'] to see what the value is.
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
I think empty() would be the function of choice here.
Last edited by kkeith29; Sep 11th, 2009 at 6:24 pm.
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
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.
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.
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
![]() |
Similar Threads
- Hotmail Access Trouble (Web Browsers)
- Trouble loading Norton Go Back Software (Windows Software)
- I'm having trouble with IE6 (Web Browsers)
- rundll32 trouble (Viruses, Spyware and other Nasties)
- my win 98 is in trouble (Windows 95 / 98 / Me)
- Trouble opening certain files... (Windows 95 / 98 / Me)
- Trouble installing Pather (OS X)
- sims trouble (Windows NT / 2000 / XP)
Other Threads in the PHP Forum
- Previous Thread: How can php recognize user?
- Next Thread: Find random string between main string?
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube






