gpt4 book ai didi

php mysql_num_rows() 函数不起作用

转载 作者:行者123 更新时间:2023-11-30 00:29:33 25 4
gpt4 key购买 nike

这是我的 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;
?>

最佳答案

您应该使用mysqli_num_rows($result);而不是mysql_num_rows($result);

关于php mysql_num_rows() 函数不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22616206/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com