PHP & mysql - please help!
Posted: Mon May 04, 2009 5:23 pm
I've tried googling and googling for this but can't seem to come up with any luck. I am trying to write a really simple username / password verifier in PHP. wondering if there are any webby type people on here I thought I would give this a go - I am really really really stucked....
What I have is:
Which was nicked off google.
I always get the error
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in F:\xampp\htdocs\SHR\checklogin.php on line 30 (line 30 being $db_pass = mysql_result($q, 0)
And it always comes up with "win" whatever happens. Suggestions please????
What I have is:
Code: Select all
<?php
$login = $_POST['login'];
$password = $_POST['password'];
$q = mysql_query("SELECT m_pwd FROM member WHERE m_uname=='$login'");
$db_pass = mysql_result($q, 0);
if($password == $db_pass)
{
echo "Win";
}
else echo "Fail";
?>
I always get the error
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in F:\xampp\htdocs\SHR\checklogin.php on line 30 (line 30 being $db_pass = mysql_result($q, 0)
And it always comes up with "win" whatever happens. Suggestions please????