mysqli - number of rows in database - prepared statements - php -
i can't seem work out how retrieve number of rows database using query, whenever run query returns 0 though it's in database
$username = $_post['username']; $hash = password_verify($password, $passwordcheck); if($stmt = $conn -> prepare("select username, email, password users (username = ? or email = ?) , password = ?")) { $stmt -> bind_param("sss", $username, $username, $hash); $stmt -> execute(); $stmt -> bind_result($checkedusername, $checkedemail, $checkedpassword); $stmt -> fetch(); $numberofrows = $stmt->num_rows; $stmt -> close(); } echo '# rows: '.$numberofrows;
can give me hints? can't see wrap head around it, thanks.
btw, $hash has been queried prior statement.
posting community wiki:
add $stmt->store_result();
after execute()
Comments
Post a Comment