0

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\registration\login.php on line 19
is the error i get when i run the below code
i cant figure out what is wrong with it. :(

<?php

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

if ($username&&$password){
    $connect = mysql_connect("localhost","root","") or die("Couldn't connect!");
    mysql_select_db("phplogin") or die("Couldn't find db");
    

    
$query = mysql_query("SELECT * FROM users WHERE username='$username");

$numrows = mysql_num_rows($query);

echo $numrows;

    
}
else
    die("Please enter a username and password");
?>
2
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by mazeroth
0

It's no problem, it always helps to have a second par of eyes for things like that.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.