Originally
posted by
Celphi:
That's PHP 5 mFrost, as I just said.
http://php.net/ChangeLog-4.php
Version 4.3.7
03 Jun 2004
Fixed handling of return values from stored procedures in mssql_execute() with multiple result sets returned. (Frank)
well according to the above PHP has been handling Stored Procedures just fine since at least Version 4.3.7 or jun 2004, and probably much sooner...
google is your friend
the following goes way back to 2000 ... however the following shows it is actually possible to connect PHP 4.3 to a SQL Server and run an SP ;)
mramirez at star-dev dot com
01-Mar-2005 01:23
Hi, I was trying to execute an stored procedure with
PHP 4.3.10 and MS SQL Server 6.5 using PHP function
"odbc_exec" and ODBC.
The problem was that it returned an ouput parameter
and didn't know the right PHP functions and SQL
syntax to call it.
Finally after looking elsewhere, it worked this way:
<html>
<title>test.php</title>
<body>
<?php
$server = 'myservername';
$database = 'mydatabasename';
$username = 'myusername';
$password = 'mypassword';
$connection_string =
'DRIVER={SQL SERVER};SERVER=' . $server . ';DATABASE=' . $database;
$connection = odbc_connect($connection_string, $username, $password);
$sql = "BEGIN ";
$sql .= " declare @MyOutputValue int ";
$sql .= " execute MyStoredProc @MyOutputValue output select @MyOutputValue ";
$sql .= "END ";
echo '<form>' . chr(13);
echo '<table border="1">' . chr(13) . chr(13);
echo '<tr>';
echo '<td><b>Valor</b></td>';
echo '</tr>';
$query = odbc_exec($connection, $sql);
while(odbc_fetch_row($query))
{
echo '<tr>' . chr(13);
// "odbc_result" = "FieldByNumber(Index)",
// "Index" starts with 1 not 0 !!! :
$returnvalue = odbc_result($query, 1);
echo '<td>' . $returnvalue . '</td>';
echo '</tr>' . chr(13);
echo chr(13);
}
echo '</table>' . chr(13);
echo '</form>' . chr(13);
odbc_free_result($query);
odbc_close($connection);
?>
</body>
</html>
Good Luck.
http://algorytmy.pl/...hp/function.odbc-exec.php