note 45437 rejected from function.mssql-query by irchtml
| From: | irchtml@php.net | Date: | Wed, 02 Mar 2005 15:22:15 +0000 |
| Subject: | note 45437 rejected from function.mssql-query by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-85787@lists.php.net to get a copy of this message | ||
Note Submitter: arun dot desh at gmail dot com
----
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!!
}
?>