ODBC and output parameters
| From: | Erik Olson | Date: | Tue, 11 Jul 2000 20:20:49 +0000 |
| Subject: | ODBC and output parameters | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1045@lists.php.net to get a copy of this message | ||
Sorry to reiterate my question, but I'm shamelessly re-submitting it:
Do OUTPUT parameters work with SQL stored procedures?
the following code uses ODBC and attempts to prepare a statement and exec it
with a three element array called $sqldata[]. The third parameter is
supposed to be an output parameter.
In VB you need to specify varchar, single, integer, input, output, etc for
paramters. The php docs simply show passing an array. Where can I find
more information on this?
<?php
function Error_Handler( $msg, $cnx )
{
echo "$msg \n";
odbc_close( $cnx );
exit();
}
$userid="erik" ;
$password="moo" ;
$control="5444409";
$lettercode="2";
$vchMessage = " " ;
$cnx = odbc_connect( "CustomerCenter", "$userid", "$password" );
if ( ! $cnx ) {
Error_Handler( "Error in odbc_connect", $cnx );
}
$ex = odbc_prepare( $cnx, "[Customer Center]..spmail_ReturnMail
@iApplicationID=?,@tiLetterType=?,@vchMessage=? OUTPUT");
if ( ! $ex ) {
Error_Handler( "Error in prepare", $cnx );
}
$sqldata = array($control, $lettercode, "@vchMessage");
print("<P> Before: $sqldata[0] $sqldata[1] $sqldata[2]\n");
if ( ! odbc_execute( $ex, &$sqldata) ) {
Error_Handler( "Error in odbc_exec.", $cnx );
}
print("<P> After: $sqldata[0] $sqldata[1] $sqldata[2]\n");
odbc_close( $cnx );
?>