SQL Server stored procedure error while executing from php
I am trying to execute a stored procedure from php.
In the php code iam sending a integer parameter to the stored procedure
$orderId =824;
$result =mssql_bind($sp, "@orderID", $orderId, SQLINT1, true, false);
I getting an error
mssql_execute() [function.mssql-execute]: messag开发者_如何学Ce: The formal parameter "@orderID" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output. (severity 16)
Can any one say the reason please
The document of mssql_bind gives the signature of it as:
bool mssql_bind ( resource $stmt , string $param_name , mixed &$var , int $type [, bool $is_output = false [, bool $is_null = false [, int $maxlen = -1 ]]] )
So your problem is you're setting $is_output
as true.
Use
$orderId =824;
$result =mssql_bind($sp, "@orderID", $orderId, SQLINT1, false, false);
You must create your stored procedure so that it indicates that the parameter as an OUTPUT variable.
DECLARE MyProc (@orderID int OUTPUT) AS ...
精彩评论