Re: mysql null values
| From: | Chris Adams | Date: | Sun, 03 Sep 2000 02:01:06 +0000 |
| Subject: | Re: mysql null values | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2597@lists.php.net to get a copy of this message | ||
> How would I identify a mysql null value in php? I tried using a
statement
> like if($row[0] == "NULL") but that did not work. ($row is the output of
> mysql_fetch_row($result)) Any suggestions?
A null value will show up as undefined:
$document = mysql_fetch_array($query);
if (!isset($document['Author'])) echo "Author was NULL";
Presumably this would also work:
list($foo, $bar, $baz) = mysql_fetch_row($query);
if (!isset($bar)) echo "bar was null";