note 46854 added to function.mssql-fetch-array
| From: | archwisp at gmail dot com | Date: | Mon, 25 Oct 2004 21:28:32 +0000 |
| Subject: | note 46854 added to function.mssql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-79094@lists.php.net to get a copy of this message | ||
[Editor's Note: NULLs *are* distinguishable from 0. See the manual section on comparison
operators. ]
microsoft sql 2000 server
php running on windows 2000
Using the $row = mssql_fetch_array($result)
A null value will return 0, this is a problem if you are using 0 and some identifier for a value.
you should convert all nulls to something like -1 or "NO VALUE"
******
After extensive testing, the above statements both seem to be true. You *can* distinguish between 0
and null values in PHP; however, the mssql_fetch_array function does not set null colums to the php
NULL value.
if ($row['Null_Column'] === 0) { print('pass'); }
A null column passes the above test. Seems to be a bug in the function.
----
Manual Page -- http://www.php.net/manual/en/function.mssql-fetch-array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46854
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46854&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46854&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46854&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46854&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46854&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46854&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46854&report=yes
Search -- http://master.php.net/manage/user-notes.php