Tuesday, August 28, 2018

Warning for mysql_fetch_assoc() in php

Below is the Warning message getting:




Warning: mysql_fetch_assoc() expects parameter 1 to be resource,
object given in E:\HTML Learn\Hocus\profile.php on line 11





line 11 is :



$get = mysql_fetch_assoc($check);


full code:





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 "

User tidak terdaftar

";
exit();
}

}
}
?>

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...