4egidio Posted November 22, 2008 Share Posted November 22, 2008 I have a website that sells video games. I would like a user to click on a letter (ex. M and have it bring up all the games beginning with M) however I have different systems (xbox, nintendo) and I would need it sorted by these too. For ex. I need a page that just shows xbox games beginning with M. I started to do this by using the like format. See below SELECT * FROM mastergamelist WHERE `Description` LIKE 'M%'AND 'System'='Xbox' This is showing me all games that start with M in Xbox system. My question is, how can create the query so that I don't have make a new query for different game systems and every letter. I only have one table and two 3 rows of data (ID,System and Description). Quote Link to comment Share on other sites More sharing options...
peranha Posted November 22, 2008 Share Posted November 22, 2008 $letter = 'letter'; $system = 'system'; SELECT * FROM mastergamelist WHERE `Description` LIKE '$letter%'AND 'System'='$system' Something like that would work. Just use variables. how you set them is up to you. Quote Link to comment Share on other sites More sharing options...
4egidio Posted November 22, 2008 Author Share Posted November 22, 2008 thank you for your help but I am very new to this. Is there a tutorial on this site for creating variables? I use dreamweaver and they put the code in for me and I don't see a place to add variables. Quote Link to comment Share on other sites More sharing options...
corbin Posted November 22, 2008 Share Posted November 22, 2008 http://www.google.com/search?hl=en&q=php+tutorial&btnG=Google+Search&aq=f&oq= Quote Link to comment Share on other sites More sharing options...
revraz Posted November 22, 2008 Share Posted November 22, 2008 Remove the single quotes around System System='$system' Quote Link to comment Share on other sites More sharing options...
4egidio Posted November 22, 2008 Author Share Posted November 22, 2008 I found in Dreamweaver where to set my variable (see below), but I'm getting a error -- Missing type for variable:system SELECT * FROM mastergamelist WHERE `Description` LIKE '$letter%'AND System='$system' Name: letter Type: text Default Value: 1 Runtime Value: $_Get['System'] Name: System Type: text Default Value: 1 Runtime Value: $_get['System'] Quote Link to comment Share on other sites More sharing options...
fenway Posted November 24, 2008 Share Posted November 24, 2008 I found in Dreamweaver where to set my variable (see below), but I'm getting a error -- Missing type for variable:system That's not a mysql error. 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.