I am trying to execute a stored procedure from php.
我试图从PHP执行存储过程。
In the php code iam sending a integer parameter to the stored procedure
在php代码中iam向存储过程发送一个整数参数
$orderId =824;
$result =mssql_bind($sp, "@orderID", $orderId, SQLINT1, true, false);
I getting an error
我收到了一个错误
mssql_execute() [function.mssql-execute]: message: The formal parameter "@orderID" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output. (severity 16)
mssql_execute()[function.mssql-execute]:message:形式参数“@orderID”未声明为OUTPUT参数,而是在请求的输出中传递的实际参数。 (严重程度16)
Can any one say the reason please
任何人都可以说出理由
2 个解决方案
#1
3
The document of mssql_bind gives the signature of it as:
mssql_bind的文档给出了它的签名:
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.
所以你的问题是你将$ is_output设置为true。
Use
$orderId =824;
$result =mssql_bind($sp, "@orderID", $orderId, SQLINT1, false, false);
#2
0
You must create your stored procedure so that it indicates that the parameter as an OUTPUT variable.
您必须创建存储过程,以便将参数指示为OUTPUT变量。
DECLARE MyProc (@orderID int OUTPUT) AS ...
#1
3
The document of mssql_bind gives the signature of it as:
mssql_bind的文档给出了它的签名:
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.
所以你的问题是你将$ is_output设置为true。
Use
$orderId =824;
$result =mssql_bind($sp, "@orderID", $orderId, SQLINT1, false, false);
#2
0
You must create your stored procedure so that it indicates that the parameter as an OUTPUT variable.
您必须创建存储过程,以便将参数指示为OUTPUT变量。
DECLARE MyProc (@orderID int OUTPUT) AS ...