ID: 31587
User updated by: php at yvanrodrigues dot com
Reported By: php at yvanrodrigues dot com
Status: Open
Bug Type: MSSQL related
Operating System: Windows 2000/IIS 5.0/PHP 4.3.11
PHP Version: 4.3.10
New Comment:
obviously that should read:
if(mssql_query($sql) === false) { echo 'yikes!'; }
Previous Comments:
------------------------------------------------------------------------
[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