mogmog Posted November 6, 2008 Share Posted November 6, 2008 Hi, I have a little problem with a SQL query I need which Ive been stuck on for a little while. I have the following tables: games: g_id g_title g_description keywords: g_id word What I am doing is creating a search which searches through the games by keywords associated with the game and the game title. Ive made the php scripts that get the string and breaks it down and creates a SQL query searching for each keyword and if the words are like any g_title. However I receive a invalid sql object error when I run the query. My methods and setup is all ok as other querys run fine. Im just unsure exactly what I am doing wrong with the following query for example: SELECT * FROM games WHERE g_id IN ( SELECT g_id FROM games, keywords WHERE keywords.word="shooter" OR games.g_title LIKE "%shooter%" ) I know the problem is in the nested query as if I remove the "OR games.g_title LIKE "%shooter%"" the uery works fine./ Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/131615-solved-querying-two-tables-for-a-id/ Share on other sites More sharing options...
mogmog Posted November 6, 2008 Author Share Posted November 6, 2008 Sorted. ...Thanks browsers Quote Link to comment https://forums.phpfreaks.com/topic/131615-solved-querying-two-tables-for-a-id/#findComment-683673 Share on other sites More sharing options...
fenway Posted November 6, 2008 Share Posted November 6, 2008 Sorted. ...Thanks browsers How about explaining your solution? Quote Link to comment https://forums.phpfreaks.com/topic/131615-solved-querying-two-tables-for-a-id/#findComment-683723 Share on other sites More sharing options...
mogmog Posted November 7, 2008 Author Share Posted November 7, 2008 Nah, just delete the topic. Quote Link to comment https://forums.phpfreaks.com/topic/131615-solved-querying-two-tables-for-a-id/#findComment-684426 Share on other sites More sharing options...
fenway Posted November 7, 2008 Share Posted November 7, 2008 Nah, just delete the topic. Not an option... try again. Quote Link to comment https://forums.phpfreaks.com/topic/131615-solved-querying-two-tables-for-a-id/#findComment-684530 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.