[英]php mysql_num_rows() function not working
This is my php code to print number of rows in database.Actually there are 3 rows in the database matching to my query.But "echo $num" in my code is not printing anything Please help.This is my code 这是我的php代码,用于打印数据库中的行数。实际上数据库中有3行与我的查询匹配。但是我的代码中的“ echo $ num”没有打印任何内容,请帮助。这是我的代码
<?php
include('db.php');
$name=$_POST['name'];
$passwd=$_POST['password'];
$qry="SELECT * FROM user where name='$name' AND password='$passwd'" ;
$result=mysqli_query($con,$qry) or die("Error attempting query");
$num = mysql_num_rows($result);
echo $num;
?>
You should use mysqli_num_rows($result);
您应该使用
mysqli_num_rows($result);
instead of mysql_num_rows($result);
而不是
mysql_num_rows($result);
. 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.