MySQLi num_rows returns 0

前端 未结 3 1472
北荒
北荒 2020-12-22 07:28

Here\'s my code

$stmt = $conn->mysqli->stmt_init();
$stmt = $conn->mysqli->prepare(\'SELECT Username, EmailVerified, Blocked FROM user WHERE Emai         


        
3条回答
  •  一个人的身影
    2020-12-22 07:56

    num_rows is a property of mysqli_stmt, not of a result resource. So you should be doing:

    $result = $stmt->get_result();
    
    // Also check strict comparison against int 0,
    // to avoid incorrect equality with boolean FALSE
    if($stmt->num_rows === 0){
        echo 'No rows found';
    }
    

提交回复
热议问题