|
-
Jun 25th, 2003, 12:00 AM
#1
Return of the db errors...
I'm trying to create a simple login. Here's my PHP code for verifying if the username and password are correct.
PHP Code:
<?
$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?
-
Jun 25th, 2003, 11:34 AM
#2
Frenzied Member
mysql_result needs 2 parameters. and it will only return 1 result, not all 3. fix this and I bet the rest go away.
mysql_result ( resource result, int row )
to get all the results you need mysql_fetch_array(), not mysql_result()
oh and
$LOGINQUERY
$loginquery
those are very different variables.
-
Jun 25th, 2003, 05:03 PM
#3
NYYAAAAAAAAAAAAAAAAARRRRGGGGGGGHHHHHHHHH
-
Jun 25th, 2003, 09:06 PM
#4
Frenzied Member
what was that for?????
-
Jun 26th, 2003, 02:13 AM
#5
Frustration over a silly error.
Thanks, problem solved.
-
Jun 26th, 2003, 08:24 AM
#6
Frenzied Member
hehe ok
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|