PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
session_start();
$fk_memberid=$_POST['fk_memberid'];
$pwd=$_POST['password'];
// now you can check the POST variables for possible code injection...
mysql_connect("localhost", "username", "mypass") or die(mysql_error());
mysql_select_db("mydb") or die(mysql_error());
if (isset($_POST['submit'])) {
$sql="SELECT U_PK, fk_memberid FROM members WHERE fk_memberid='$fk_memberid' AND password='$pwd' ";
if ($row=mysql_fetch_assoc($result)) {
extract($row);
if ($password == $pwd) {
echo "Welcome back, $fk_memberid<br />";
} else {
echo "Incorrect Password. Try again<br />";
}
} else {
echo "Incorrect Login. Try again<br />";
}
}
?>
however when i try logging in it gives me the following error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/public_html/myaccount.php on line 12
Incorrect Login. Try again
does anyone know why this is happening
thanks for any guidance