Frage

I have a PHP script which fires a MySQL SP. The SP cmd works when run directly against db (I'm using PhpMyAdmin UI). When tested, the PHP returns error 'Warning: mysql_num_rows() expects parameter 1 to be resource' due to the fact there is nothing returned from the SP...when i debug the script i see the variable $result1 has all its params set to null.

There is another SP executed successfully using the same code above this one in the script so im a bit puzzled. Any ideas what the issue is?

$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);
}

The SP...enter image description here

War es hilfreich?

Lösung

Shouldn't it be mysqli_num_rows? thanks 'I Can Has Cheezburger' :

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top