scmeeker Posted August 9, 2010 Share Posted August 9, 2010 I can't figure out why I keep getting a syntax error with this part of the code? Am I missing something? Thanks! $get_group = mysql_query("SELECT group FROM artist WHERE username = '".$_GET["username"]."'") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/210174-keep-getting-syntax-error/ Share on other sites More sharing options...
trq Posted August 9, 2010 Share Posted August 9, 2010 What is the exact error? Quote Link to comment https://forums.phpfreaks.com/topic/210174-keep-getting-syntax-error/#findComment-1096809 Share on other sites More sharing options...
scmeeker Posted August 9, 2010 Author Share Posted August 9, 2010 Here is the 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 'group FROM artist' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/210174-keep-getting-syntax-error/#findComment-1096830 Share on other sites More sharing options...
JasonLewis Posted August 9, 2010 Share Posted August 9, 2010 The name 'group' is a reserved MySQL word. There is a list of reserved words on the MySQL website. Take care when using these words for column names. Quote Link to comment https://forums.phpfreaks.com/topic/210174-keep-getting-syntax-error/#findComment-1096834 Share on other sites More sharing options...
Pikachu2000 Posted August 9, 2010 Share Posted August 9, 2010 I suspect 'group' is a reserved word. Enclose it in backticks and try it again: `group` Quote Link to comment https://forums.phpfreaks.com/topic/210174-keep-getting-syntax-error/#findComment-1096835 Share on other sites More sharing options...
scmeeker Posted August 9, 2010 Author Share Posted August 9, 2010 Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/210174-keep-getting-syntax-error/#findComment-1097065 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.