Login Register






Need help with a simple script filter_list
Author
Message
Need help with a simple script #1
Hello! I have a problem with a script I wrote. It's basically an email activation script. It sends the email, but when I do this:

PHP Code:
<?php include('includes/header.php'); include("includes/config.php"); $email = $_GET['email']; $key = $_GET['key']; $email = strip_tags($email); $email = trim($email); $key = strip_tags($key); $key = trim($key); $sql = mysql_query("SELECT * FROM confirm WHERE email = '$email' AND key = '$key' ORDER BY id LIMIT 1")or die(mysql_error()); while($result = mysql_fetch_array($sql)) ; { $key2 = $result['key']; $email2 = $result['email']; } if($key == $key2 && $email == $email2){ $sql = mysql_query("UPDATE users SET user_confirm = 1 WHERE user_mail = '$email2'")or die(mysql_error()); echo "Your account have been activated, and is ready to use!"; }else{ echo 'The key or email does not fit to these you entered in URL at the begining, or other error occured! Contact an admin!'; } include('includes/footer.php'); ?>

It gives me this:
Code:
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 'key = 'ccdc11d5b0246e2712bc6849a182fb00' ORDER BY id LIMIT 1' at line 1

Any idea where I went wrong in the first query?
I am sure that the tables and fields that are getting called exists in the database.

Reply





Messages In This Thread
Need help with a simple script - by TechSaavy - 03-10-2013, 01:07 PM
RE: Need help with a simple script - by Prestige - 03-10-2013, 06:55 PM
RE: Need help with a simple script - by TechSaavy - 03-10-2013, 08:30 PM
RE: Need help with a simple script - by EKNOZ - 03-10-2013, 08:41 PM
RE: Need help with a simple script - by cxS - 03-11-2013, 01:56 AM