ODBC/Sybase Stored Procedure w/Output Variables
| From: | Homsher, Dave | Date: | Thu, 09 Mar 2000 17:22:42 +0000 |
| Subject: | ODBC/Sybase Stored Procedure w/Output Variables | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-16588@lists.php.net to get a copy of this message | ||
Hi all,
I am running into some database difficulty and am in desperate need of
assistance ... !
I am trying to run a stored procedure from Sybase using an ODBC connection.
The SP has two output variables. When I run the same SQL code (obviously
with the appropriate values) from an ISQL window, I receive two results, one
returns no rows, and the other returns the desired values. When I try to run
the SP using the following code, I can only retrieve the result that returns
no rows. I am guessing that I need to use the odbc_prepare function, but I
cannot find good enough documentation to tell. Maybe I need do this as a
transaction ??? how ??? Any help would be greatly appreciated ...
<%
$connection_id = odbc_connect("TEST", "user", "password");
$query =
"DECLARE @error_hdr varchar(50), @error_msg varchar(255)\n".
"EXEC sys_com_err_msg_sp\n".
"@err_key = \"$error_key\",\n".
"@err_code = $error_code,\n".
"@err_level = \"$error_level\",\n".
"@hdr = @error_hdr output,\n".
"@msg = @error_msg output\n".
"SELECT @error_hdr, @error_msg";
$result_id = odbc_exec($query);
odbc_result_all($prepare_id, "border=1 width=90%");
odbc_close($connection_id);
%>
Thanks!
Dave Homsher
MACtac Information Technology
"He who controls the past controls the future. He who controls the present
controls the past." - George Orwell, "1984"