以下是警告信息:
警告:mysql_fetch_assoc()期望参数1是资源, 在第11行的E:\ HTML Learn \ Hocus \ profile.php中给出的对象
第11行是:
$get = mysql_fetch_assoc($check);
<?php include ( "./inc/header.inc.php" ); ?>
<?php
if (isset($_GET['u']))
{
$username = mysqli_real_escape_string($conn, $_GET['u']);
if (ctype_alnum($username))
{
//cek user
$conn = mysqli_connect("localhost", "root", "") or die("error MYSQL");
mysqli_select_db($conn, 'skey');
$check = mysqli_query($conn, "SELECT username, first_name FROM users WHERE username='$username'");
if (mysqli_num_rows($check)==1)
{
$get = mysql_fetch_assoc($check);
$username = $get['username'];
$firstname = $get['first_name'];
}
else
{
echo "<h2>User tidak terdaftar</h2>";
exit();
}
}
}
?>
答案 0 :(得分:0)
您正在混合mysqli_*
和mysql_*
个功能。停止这样做。