note 56812 added to function.is-null
| From: | jacob at gnu dot org | Date: | Thu, 15 Sep 2005 18:45:05 +0000 |
| Subject: | note 56812 added to function.is-null | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95243@lists.php.net to get a copy of this message | ||
The notes from the other users are confusing on what happens when a value from a mysql query is NULL
(SQL NULL). After doing a few tests, it looks like the way to test if the value is NULL or not is
to use is_null($whatever)
also, it looks like this is functionally the same as (! isset($whatever) )
when you set $whatever =NULL, isset($whatever) returns false now...
is ! isset($whatever) == is_null($whatever) for all versions of php?
btw, the reason why people want to check for the NULL in the application is when they use a query
that returns multiple rows of multiple columns where some columns are NULL is some rows, but not
others and they don't want to have multiple SELECT queries for each possible outcome.
----
Manual Page -- http://www.php.net/manual/en/function.is-null.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56812
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56812&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56812&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56812&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56812&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56812&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+56812&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56812&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56812&report=yes
Search -- http://master.php.net/manage/user-notes.php