执行SP时PHP MySql查询错误

时间:2014-02-18 10:30:51

标签: php mysql stored-procedures phpmyadmin

我有一个启动MySQL SP的PHP脚本。直接针对db运行时,SP cmd可以正常工作(我正在使用PhpMyAdmin UI)。测试时,PHP返回错误'警告:mysql_num_rows()期望参数1是资源',因为没有从SP返回任何内容...当我调试脚本时,我看到变量$ result1已设置其所有参数为空。

在脚本中使用与此相同的代码成功执行了另一个SP,所以我有点困惑。任何想法是什么问题?

$result1 = $mysqli->query("CALL sp_playerInvite_pin_select('samsmith@hotmail.com')");
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 ... enter image description here

1 个答案:

答案 0 :(得分:0)

不应该是mysqli_num_rows吗?谢谢'我能拥有Cheezburger':