phrozenflame Posted December 31, 2006 Share Posted December 31, 2006 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 1The 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 Quote Link to comment Share on other sites More sharing options...
Orio Posted December 31, 2006 Share Posted December 31, 2006 Try adding "`" around your table name: item_list_price_groups will become `item_list_price_groups`.Orio. Quote Link to comment Share on other sites More sharing options...
phrozenflame Posted December 31, 2006 Author Share Posted December 31, 2006 Thank you Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 31, 2006 Share Posted December 31, 2006 The problem is that "group" is a reserved word (i.e. GROUP BY). You need to enclose it with back quotes. Try this:$query = "SELECT * FROM item_list_price_groups where `Group` = '$group'"; Quote Link to comment Share on other sites More sharing options...
phrozenflame Posted December 31, 2006 Author Share Posted December 31, 2006 Thanks again Quote Link to comment 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.