note 45437 added to function.mssql-query
| From: | arun dot desh at gmail dot com | Date: | Tue, 07 Sep 2004 12:25:21 +0000 |
| Subject: | note 45437 added to function.mssql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76145@lists.php.net to get a copy of this message | ||
I experienced a strange behaviour in my php code.
Our code calls mssql_query function which executes a stored procedure.
I was expecting a result set to be returned which contains just one column named "RESULT".
Its value is set to 1 when there is some error in executing the procedure or 0 when everything went
well.
Now what happened is when the script(PHP) was executed under Linux (Apache) mssql_query gave a
typical warning message and also returned (as expected) a result set with RESULT set to 1.
But when same script is executed in Windows then mssql_query gave me warning message about the
failure but NO RESULT SET WAS returned!!
Have anybody experienced this kind of error? Please help.
My code:
<?php
// Connect to db
// There was PRIMARY_KEY Constraint violation in the stored proc
// On any error stored proc was built to result a result set as described above.
$res = mssql_query("EXECUTE my_procedure");
// I get this in both Linux and Windows
Warning: mssql_query(): message: Violation of PRIMARY KEY. Cannot insert duplicate key in object
'abc'. (severity 14)
if($res)
{
// I get here if in Linux
}
else
{
// I get here if in Windows!!
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.mssql-query.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45437
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45437&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45437&report=yes
Search -- http://master.php.net/manage/user-notes.php