note 100255 added to function.odbc-prepare
| From: | brad dot westness at gmail dot com | Date: | Mon, 04 Oct 2010 17:39:57 +0000 |
| Subject: | note 100255 added to function.odbc-prepare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172946@lists.php.net to get a copy of this message | ||
When working with MSSQL over FreeTDS, calling a stored procedure that accepts a variable in the
following way DOES NOT work:
<?php
$results = odbc_prepare($conn, "{CALL sp_Test(?)}");
odbc_exec($results, array("some string"));
?>
From what I've gleaned via trial and error, the "some string" never gets sufficiently
bound to the ? as the variable input (perhaps because there is no ODBC equivalent to the
mssql_bind() method). The stored procedure will always return an SQL Server error code HY000.
The following works for me (although I don't think it's documented anywhere):
<?php
$results = odbc_prepare($conn, "{CALL sp_Test('some string')}");
odbc_exec($results, array());
?>
----
Server IP: 192.41.42.26
Probable Submitter: 140.146.159.196
----
Manual Page -- http://www.php.net/manual/en/function.odbc-prepare.php
Edit -- https://master.php.net/note/edit/100255
Del: integrated -- https://master.php.net/note/delete/100255/integrated
Del: useless -- https://master.php.net/note/delete/100255/useless
Del: bad code -- https://master.php.net/note/delete/100255/bad+code
Del: spam -- https://master.php.net/note/delete/100255/spam
Del: non-english -- https://master.php.net/note/delete/100255/non-english
Del: in docs -- https://master.php.net/note/delete/100255/in+docs
Del: other reasons-- https://master.php.net/note/delete/100255
Reject -- https://master.php.net/note/reject/100255
Search -- https://master.php.net/manage/user-notes.php