$query = "SELECT * FROM tbl_usuarios WHERE email = 'teste@teste.com' and senha = '123456'";
$res=mysql_query($query);
$number=mysql_num_rows($res);
警告:mysql_num_rows期望参数1是给定的资源布尔值 我没有想到为什么它给我错误
答案 0 :(得分:1)
可能是连接错误
试
<?php
$con = mysqli_connect('localhost', 'username', 'password','database');
$query= "SELECT * FROM tbl_usuarios WHERE email = 'teste@teste.com' and senha = '123456'";
$res = mysqli_query($con, $query) or die(mysqli_error($con));
while($return_row = mysqli_fetch_array($res, MYSQLI_ASSOC)){
$name = $return_row['name'];
}
?>