php – 调用未定义的函数MYSQL_NUM_ROWS()[复制]
发布时间:2020-12-13 21:58:47 所属栏目:PHP教程 来源:网络整理
导读:参见英文答案 Deprecated: mysql_connect()????????????????????????????????????15个 我试图用PHP验证登录但是收到此错误: Fatal error: Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in /opt/lampp/htdocs/social/index.php:100 Stack t
|
参见英文答案 >
Deprecated: mysql_connect()????????????????????????????????????15个
我试图用PHP验证登录但是收到此错误:
这是我的代码 if(isset($_POST['login'])){
$studentid = $_POST['studid'];
$pass = $_POST['password'];
$query2 = mysqli_query($con,"SELECT * FROM members WHERE student_id = '$studentid' AND password = '$pass' ") or die (mysqli_connect_error());
while($studid = mysqli_fetch_object($query2))
{
echo "$studid->member_id";
}
$numberOfRows = MYSQL_NUM_ROWS($query2);
if ($numberOfRows == 0)
{
}
else if ($numberOfRows > 0){
$wewness = mysql_query("SELECT * FROM members WHERE student_id = $studentid")or die(mysql_error());
$getid = mysql_fetch_array($wewness);
if($getid['account_status']==0){
$_SESSION['login'] = 'maybe';
$_SESSION['member_id'] = $getid['member_id'];
$_SESSION['studentid'] = $getid['student_id'];
header('location:registerexec.php');
}elseif($getid['account_status']==2){
$_SESSION['login'] = 'true';
$_SESSION['member_id'] = $getid['member_id'];
$_SESSION['studentid'] = $getid['student_id'];
header('location:hometest.php');
}elseif($getid['account_status']==1){
$_SESSION['login'] = 'maybe';
$_SESSION['member_id'] = $getid['member_id'];
$_SESSION['studentid'] = $getid['student_id'];
header('location:fill.php');
}
}
}
解决方法
对于PHP 5以上的PHP版本,我们必须使用mysqli_ functions
mysqli_num_rows() (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
