I'm having problems trying to insert a key value (which I generate) into a table (jml_acymailing_subscriber).
$generateKey = md5(substr($email[1],0,strpos($email[1],'@')).rand(0,10000000));
$subid = 3603;
$sql2 = "UPDATE jml_acymailing_subscriber SET key='$generateKey', WHERE subid='$subid'";
$result2 = mysql_query($sql2,$con) or trigger_error(mysql_error(),E_USER_ERROR);
The key type is:
TYPE --> varchar(250)
ORDENATION --> utf8_general_ci
NULL --> yes
DEFAULT --> NULL
And this is the error I get:
Fatal 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='15e3e092aa8672a6f7ad3e8a5a1db537', WHERE subid='3603'' at line 1 in
/public_html/bootstrap3/donarAltaCatala.php on line 136
I have no problem inserting values like userid
, name
, created
or any other ones. Any one knows where is the problem? I'm starting in PHP/SQL...
Thank you! I really appreciate it!