The-Last-Escape Posted April 29, 2007 Share Posted April 29, 2007 Here's the error I'm getting: 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 = 'KK'' at line 1 The variable $group is being stored in the url as a link from a previous page: [a href=\"http://ecolab.7cpco.com/pricegroups.php?group=KK\" target=\"_blank\"]http://ecolab.7cpco.com/pricegroups.php?group=KK[/a] Here's the php code that's causing the error: $query = "SELECT * FROM item_list_price_groups where Group = '$group'"; I have other pages that work just the same as this is intended to (result based on url-stored variable). I pretty much copied the code verbatim from another application I wrote that works fine. I don't understand what could be wrong with this query. Thanks for your help. Link to comment https://forums.phpfreaks.com/topic/49217-error/ Share on other sites More sharing options...
AndyB Posted April 29, 2007 Share Posted April 29, 2007 group is a MySQL reserved word and you cannot use reserved words as table names or field names. Change group to something else. http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html Link to comment https://forums.phpfreaks.com/topic/49217-error/#findComment-241164 Share on other sites More sharing options...
The-Last-Escape Posted April 29, 2007 Author Share Posted April 29, 2007 Thanks Link to comment https://forums.phpfreaks.com/topic/49217-error/#findComment-241177 Share on other sites More sharing options...
roopurt18 Posted April 29, 2007 Share Posted April 29, 2007 Alternatively you could have put back ticks around it. Link to comment https://forums.phpfreaks.com/topic/49217-error/#findComment-241200 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.