-3

警告:mysql_fetch_assoc() 期望参数 1 是资源,F:\Softwares\xampp\htdocs\login-check.php 中给出的整数第 14 行连接错误

代码:

<?php
session_start();
if(isset($_SESSION['username']))
{
header("location:home.php");
}
else
{
$user=$_POST['mailid'];
$pass=$_POST['password'];
$con=mysqli_connect("127.0.0.1","rahulk","","weltit");
$get=mysqli_query($con,"SELECT * FROM mem WHERE mailid='$user' AND password='$pass'");
$check=mysqli_num_rows($get);
if ($result=mysql_fetch_assoc($check))
{
$check_pass=$result['password'];
$check_user=$result['mailid'];
if ($check_pass==$pass &&  $check_user==$user)
{
echo "matched";
}
else
{
echo "wrong pass";
}
}
else
{
echo "connection error";
}
}
?>
4

2 回答 2

0

mysql_fetch_assoc($check)应该是mysql_fetch_assoc($get)。您无法获得行号计数的结果。

于 2013-03-18T15:25:44.763 回答
0
mysql_fetch_assoc($check)

以上应该是

mysql_fetch_assoc($get)
于 2013-03-18T15:26:24.473 回答