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). Link to comment https://forums.phpfreaks.com/topic/133780-results-by-beginning-letter/ 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. Link to comment https://forums.phpfreaks.com/topic/133780-results-by-beginning-letter/#findComment-696218 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. Link to comment https://forums.phpfreaks.com/topic/133780-results-by-beginning-letter/#findComment-696273 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= Link to comment https://forums.phpfreaks.com/topic/133780-results-by-beginning-letter/#findComment-696364 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' Link to comment https://forums.phpfreaks.com/topic/133780-results-by-beginning-letter/#findComment-696402 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'] Link to comment https://forums.phpfreaks.com/topic/133780-results-by-beginning-letter/#findComment-696451 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. Link to comment https://forums.phpfreaks.com/topic/133780-results-by-beginning-letter/#findComment-697860 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.