| | |
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?
Views: 251 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess 5.2.10 access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail menu methods mlm mod_rewrite multiple mysql mysqlquery oop parse paypal pdf php problem query radio random record recursion regex remote script search security select server sessions sms soap sockets source space speed sql structure syntax system table thesishelp tutorial update updates upload url validation validator variable video web xml youtube






