been working all day on something and can’t seem to get this right…
I have a key generation script in PHP that runs some if statements, selects a license, creates a key, inserts it into the database and then emails the user the output.
The key is inserting into the database fine, and the email even sends fine with the key in it. The variable for email is $email, and is declared at this point, because it gets used down below this query to send an email (which sends). However, I can’t get this UDPATE query to work in between the two (yes, the key is already generated and inserted by now):
$username = $email;
mysql_query("UPDATE keys SET username='".$username."' WHERE key='".$userkey."'");
Username is varchar, 255.
HELP!
KEYis a reserved word in MySQL (e.g.PRIMARY KEY).If you’re going to use it as an identifier, you will have to surround the name with `backticks` in every query.
http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html