Reputation: 9
$stmt = $db->prepare("SELECT * FROM user WHERE name='Steve Job'");
$stmt->execute();
if($stmt->num_rows){
echo "1";
}
it return blank in my ajax callback. I've debugging for hours.
Upvotes: 0
Views: 29
Reputation: 8047
$stmt = $db->prepare("SELECT * FROM user WHERE name='Steve Job'");
$stmt->execute();
$stmt->store_result();
$numRows = $stmt->num_rows;
if($numRows > 0){
echo "1";
}
You need to use store_result
before working with num_rows
Upvotes: 1