我似乎对mysqli_num_rows函数有点了解。
我的mysql_query运行正常,返回它应该的内容,但是一旦我尝试计算返回的行数,num_rows就会一直返回0.
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$connect = mysqli_connect( 'localhost', 'root', 'root', 'accounts');
//check if two passwords are equal to each other
if ($_POST['pass'] == $_POST['confirm_pass']) {
//define email variable with submitted values from $_POST
$email = $mysqli->real_escape_string($_POST['email']);
//md5 hash
$pass = md5($_POST['pass']);
//unique user test
$query = mysqli_query($connect ,'SELECT * FROM users WHERE email="$_email"', MYSQLI_STORE_RESULT);
$numrows = mysqli_num_rows($query);
print_r ($numrows) ; die();
}
}
?>
非常感谢帮助我,这个功能我