From:
[email protected]
Following this
http://www.devarticles.com/c/a/PHP/Executing-Microsoft-SQL-Server-Stored-Procedure-from-PHP-on-Linux/5/
and adding it to debian php4 src and enabling mssql
(--whit-mssql=share,usr) i even compiled php4-mssql as debian package.
I installed it but it can't work together with sybase-ct, so i disable
it in php.ini and leave only mssql.so.
But i can't make this example to work properly:
|
if we have this procedure:
CREATE PROCEDURE [procedure]
(
@sval varchar(50) OUTPUT,
@intval int OUTPUT,
@floatval decimal(6,4) OUTPUT
) AS
if @intval is null
select '@intval is null' as answer
else
select '@intval is NOT null' as answer
set @sval='Hello ' + @sval
set @intval=@intval+1
set @floatval=@floatval+1
return 10
We can use this PHP code:
<?php
$conn=mssql_connect("myhost","user","pwd");
if ($conn) {
mssql_select_db("mydb",$conn);
$stmt=mssql_init("procedure",$conn);
mssql_bind($stmt,"RETVAL",&$val,SQLINT4);
$ival=11;
$fval=2.1416;
$sval="Frank";
mssql_bind($stmt,"@sval",&$sval,SQLVARCHAR,TRUE);
mssql_bind($stmt,"@intval",&$ival,SQLINT4,TRUE);
mssql_bind($stmt,"@floatval",&$fval,SQLFLT8,TRUE);
$result=mssql_execute($stmt);
$arr=mssql_fetch_row($result);
print ("Answer: " . $arr[0] . "<br>" );
print ("RETVAL = $val ; intval = $ival ; floatval = $fval ; string = $sval");
mssql_close($conn);
}
else print("ooops!");
it executes but $ival $fval $sval are not as they expected.
Executing procedure on MsSQL server increments int values with 1 and add
Hello to $sval,
but with php i get same values ||$ival=11; $fval=2.1416; $sval="Frank";|
--
To UNSUBSCRIBE, email to
[email protected]
with a subject of "unsubscribe". Trouble? Contact
[email protected]
--- SoupGate-Win32 v1.05
* Origin: you cannot sedate... all the things you hate (1:229/2)