我在使用SQLSRV执行存储过程时遇到跟随错误。
Array (
[0] => Array (
[0] => 42000
[SQLSTATE] => 42000
[1] => 102
[code] => 102
[2] => [Microsoft]
[ODBC Driver 11 for SQL Server]
[SQL Server] Incorrect syntax near '='.
[message] =>
[Microsoft]
[ODBC Driver 11 for SQL Server]
[SQL Server]Incorrect syntax near 'r'. )
[1] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 8180 [code] => 8180 [2] => [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Statement(s) could not be prepared. [message] => [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Statement(s) could not be prepared. ) )
$tsql_callSP = "EXEC usp_u_social_twitter var_tweet = ?, var_screenname = ?, var_maxid = ?, var_link = ?, varid = ?";
我使用的代码如下
$tsql_callSP = "EXEC usp_u_social_twitter var_tweet = ?, var_screenname = ?, var_maxid = ?, var_link = ?, varid = ?";
$stmt3 = sqlsrv_prepare( $conn, $tsql_callSP, array(&$tweet, &$screenname, &$maxid, &$link, &$id));
我在这里缺少什么语法。这里列出的这些变量名称不是真正的。但我在这里缺少一些语法...
如果我提供正常的更新查询...具有相同的变量名...
,代码可以正常工作请帮助我...提前致谢... 这是什么正确的语法...即使在堆栈中也无法找到示例程序。
答案 0 :(得分:0)
你错过了" @"在存储过程的参数的开头。它应该是:
$tsql_callSP = "EXEC usp_u_social_twitter @var_tweet = ?, @var_screenname = ?, @var_maxid = ?, @var_link = ?, @varid = ?";