Hello i have been working for hours to make this script working. I want it check so the username, name, mail and code is true. If all is true it will show the password from the user and if not it will show a message like Something is wrong! That's the site with the script apelsinen.com/?p=lostpassword This is the script <b>Forgot Password</b> <?phpif (isset($_POST['submit'])){$user = $_POST['user'];$mail = $_POST['mail'];$name = $_POST['name'];$code = $_POST['code'];$sql = "SELECT * FROM users WHERE mail='$mail' AND name='$name' AND code='$code'user='$user' AND pass='$pass'";if(!mysql_query($sql)){echo "Något är fel! ".mysql_error();}else{echo "Ditt nya lösenord är ".$pass."!";}}?><html><body><tr><form action="?p=lostpassword" method="post"> <td><br>Username:<br></td> <td><input type="text" input type="text" name="user" value=""></td></tr><tr> <td><br>Mail:<br></td> <td><input type="text" name="mail" value=""></td></tr><tr> <td><br>Name:<br></td> <td><input type="text" name="name" value=""></td></tr><tr> <td><br>Secret Code:<br></td> <td><input type="text" name="code" value=""></td></tr><tr> <td> <tr> <br> <input type="submit" name="submit" value="Get Password"> </td></tr> </table></form><br><br></html></body> PHP: This is the errors Notice: Undefined variable: pass in C:\xampp\htdocs\pages\lostpassword.php on line 9 Något är fel! You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user='' AND pass=''' at line 2 PHP:
$sql = "SELECT * FROM users WHERE mail='$mail' AND name='$name' AND code='$code' user='$user' AND pass='$pass'"; PHP: look here. you wrote pass='$pass' but you have never defined $pass.