Wednesday 6 December 2017

php - Warning: mysql_fetch_assoc() expects parameter 1 to be resource, object given









I
cant seem to figure out what I'am doing wrong. So when I submit my form I get Warning
error and the





Notice: Undefined variable: dbusername in
/Library/WebServer/Documents/ArturoLuna_Final/loginCheck.php on line
30




$username
= $_POST['username'];
$password = $_POST['password'];



if($username&&$password)
{

require 'conn.php';
$query = "SELECT * FROM users WHERE
username='$username'";
$result = $mysql->query($query) or
die(mysqli_error($mysql));
$numrows =
$result->num_rows;

if ($numrows!=0)
{

while($row = mysql_fetch_assoc($result))

{
$dbusername
= $row['username'];
$dbpassword = $row['password'];

}

//check to see if they match!

if($username==$dbusername&&$password==$dbpassword)
{
echo
"youre In!";
}

else
echo "incorrect
password!";

}
else
die("that user is
dead");

//echo
$numrows;

}


else


echo ("Please Enter
Username")


what can I
be possibly doing wrong?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...