Lamez Posted December 21, 2009 Share Posted December 21, 2009 This insert query looks to be alright, however I get this 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, online) VALUES ('0', '8', '[email protected]', 'first', 'last', 'a3' at line 1 Here is the actually query: <?php //This is only a snippet function makeKey($id){ $key .= $id.rand(0, 10); //To Be Unique for($j=0; $j<=3; $j++){ $key .= rand(11, 20); } for($k=0; $k<=3; $k++){ $key .= rand(21, 30); } return $key; } $key = makeKey($id); mysql_query(" INSERT INTO ".TBL_PEOPLE." (id, level, email, first, last, password, activated, key, online) VALUES ('$id', '$level', '$db_email', '$db_first', '$db_last', '$db_pass', '0', '$key', '0') ")or die(mysql_error()); ?> Any ideas? Maybe I am just tired. Link to comment https://forums.phpfreaks.com/topic/185860-this-is-driving-me-nuts/ Share on other sites More sharing options...
trq Posted December 21, 2009 Share Posted December 21, 2009 Take a look at mysql's reserved words, key is one. ps: This is PHP coding help. Wrong board. Link to comment https://forums.phpfreaks.com/topic/185860-this-is-driving-me-nuts/#findComment-981402 Share on other sites More sharing options...
Lamez Posted December 21, 2009 Author Share Posted December 21, 2009 So it is. Also, sorry about posting in the wrong board. I forgot there was a Sql board. +1 for being a noob. Link to comment https://forums.phpfreaks.com/topic/185860-this-is-driving-me-nuts/#findComment-981405 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.