#31587 [Csd]: return value of mssql_query changed in 4.3.10, no longer returns accurate rslt.
| From: | php at yvanrodrigues dot com | Date: | Mon, 17 Jan 2005 22:42:10 +0000 |
| Subject: | #31587 [Csd]: return value of mssql_query changed in 4.3.10, no longer returns accurate rslt. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72330@lists.php.net to get a copy of this message | ||
ID: 31587
User updated by: php at yvanrodrigues dot com
Reported By: php at yvanrodrigues dot com
Status: Closed
Bug Type: MSSQL related
Operating System: Windows 2000/IIS 5.0/PHP 4.3.11
PHP Version: 4.3.10
New Comment:
I will update my unix servers. How often are the Windows binaries
updated? Thanks for the quick response.
Previous Comments:
------------------------------------------------------------------------
[2005-01-17 22:57:45] tony2001@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2005-01-17 22:11:36] php at yvanrodrigues dot com
obviously that should read:
if(mssql_query($sql) === false) { echo 'yikes!'; }
------------------------------------------------------------------------
[2005-01-17 21:27:49] php at yvanrodrigues dot com
Description:
------------
Previous to 4.3.10, mssql_query returned the following:
=== a valid result set OR
=== true if successful but no result set OR
=== false if an error occurred
Therefore if one wanted to check for an error one would use:
if(mssql_query === false) { echo 'yikes!'; }
Since 4.3.10, when using mssql_query to execute an INSERT query, a
result of false is returned even if the row was successfully inserted.
Reproduce code:
---------------
$query = "INSERT INTO DOGBERT (CATBERT) VALUES ('DILBERT')";
$rs = mssql_query($query);
if($rs === false) {
echo 'This should only print when there is an error';
}
Expected result:
----------------
$rs should only evaluate === false when there is an error (according to
the docs)
Actual result:
--------------
$rs always evaluates === false on INSERT
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31587&edit=1