I found one very cool scirpt for lost password but this row is making me problems
$r = mysql_query('INSERT INTO `keys` (username,key, vreme) VALUES ("'.$user.'", "'.$acckey.'", "'.$keyexp.'"') or die(mysql_error());
error
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, vreme) VALUES ("123123", "1ed2f5100a26298a55b2935cbea7d4a0", "1337991670"' at line 1
KEY
is a Reserved Word. As documented under Schema Object Names:
If an identifier contains special characters or is a reserved word, you must quote it whenever you refer to it. (Exception: A reserved word that follows a period in a qualified name must be an identifier, so it need not be quoted.)
[ deletia ]The identifier quote character is the backtick (“
`
”):mysql> SELECT * FROM `select` WHERE `select`.id > 100;
If the
ANSI_QUOTES
SQL mode is enabled, it is also permissible to quote identifiers within double quotation marks:mysql> CREATE TABLE "test" (col INT); ERROR 1064: You have an error in your SQL syntax... mysql> SET sql_mode='ANSI_QUOTES'; mysql> CREATE TABLE "test" (col INT); Query OK, 0 rows affected (0.00 sec)
Therefore:
mysql_query("INSERT INTO `keys` (username, `key`, vreme) VALUES ('$user', '$acckey', '$keyexp') ")
key
is a reserved keyword - enclose it in backticks
`key`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With