mendhak
Jun 25th, 2003, 12:00 AM
I'm trying to create a simple login. Here's my PHP code for verifying if the username and password are correct.
<?
$username = $_POST['username'];
$password = $_POST['password'];
$dbh=mysql_connect("localhost","root","");
mysql_select_db("mendhak");
$LOGINQUERY = "SELECT * FROM members WHERE username = '$username' AND pasword = '$password'";
$result = mysql_result($loginquery);
mysql_close();
echo $username;
echo $password;
$ifexists = mysql_numrows($result);
echo $ifexists;
?>
In the database, I have a user existing, mendhak and password mendhak. This is the error message I get:
Warning: Wrong parameter count for mysql_result() in C:\web\login.php on line 10
mendhakmendhak <-- these are the echo commands up there in the code
Warning: mysql_numrows(): supplied argument is not a valid MySQL reslut resource in C:\web\login.php on line 14
I can't see why it shouldn't be working. I'm using a simple SELECT statement on the members table. By the way, the members table has three fields: username, password and email.
What am I doing wrong?
<?
$username = $_POST['username'];
$password = $_POST['password'];
$dbh=mysql_connect("localhost","root","");
mysql_select_db("mendhak");
$LOGINQUERY = "SELECT * FROM members WHERE username = '$username' AND pasword = '$password'";
$result = mysql_result($loginquery);
mysql_close();
echo $username;
echo $password;
$ifexists = mysql_numrows($result);
echo $ifexists;
?>
In the database, I have a user existing, mendhak and password mendhak. This is the error message I get:
Warning: Wrong parameter count for mysql_result() in C:\web\login.php on line 10
mendhakmendhak <-- these are the echo commands up there in the code
Warning: mysql_numrows(): supplied argument is not a valid MySQL reslut resource in C:\web\login.php on line 14
I can't see why it shouldn't be working. I'm using a simple SELECT statement on the members table. By the way, the members table has three fields: username, password and email.
What am I doing wrong?