0
我有一个PHP脚本,它触发了一个MySQL SP。 SP cmd在直接针对db运行时工作(我正在使用PhpMyAdmin UI)。当测试时,PHP返回错误'警告:mysql_num_rows()期望参数1是资源'由于事实上没有任何返回从SP ...当我调试脚本我看到变量$ result1具有其所有参数设置为空。PHP MySql查询执行时出错SP
还有另一个SP在脚本之上使用相同的代码成功执行,所以我有点困惑。任何想法是什么问题?
$result1 = $mysqli->query("CALL sp_playerInvite_pin_select('[email protected]')");
if(!$result1) die("CALL failed: (" . $mysqli->errno . ") " . $mysqli->error);
//echo json_encode($getPlayerInvitePin);
// check for empty result, if not then there is >1 pin corresponding to email
if (mysql_num_rows($result1) > 0)
{
//looping through all results-in theory should only 1 result
while ($row = mysql_fetch_array($result1))
{
$response["pin"] = $row["player_pin"];
}
// echoing JSON response
echo json_encode($response);
}
的SP ...
你应该显示你的'sp' –
的代码不应该是'mysqli_num_rows'?你的'if'没有正确关闭。 –
您发现的错误通常发生在查询(SQL)不正常时。 –