supanoob Posted July 10, 2007 Share Posted July 10, 2007 Well basically what i want to do is this: I want to find an ammount of the same thing and echo it once but next to it have how many of that thing there are in a table. So say i have 10 wooden swords i want it to echo the image of the sword once and show x10 next to it to show that it is in the database 10 times. Link to comment https://forums.phpfreaks.com/topic/59232-counting-in-tables/ Share on other sites More sharing options...
Yesideez Posted July 10, 2007 Share Posted July 10, 2007 Can you see if I'm right here. You've got a table that contains quantities of things. When the amounts of each item is pulled from the table you'd like the item description, a picture of the item and the quantity to be shown? Link to comment https://forums.phpfreaks.com/topic/59232-counting-in-tables/#findComment-294223 Share on other sites More sharing options...
supanoob Posted July 10, 2007 Author Share Posted July 10, 2007 yeah thats pretty much it, as it stands i have each of the items showing but i have alot of 2-3 of the items so i want just 1 to be shown and the quantity of the rest to be next to it. Link to comment https://forums.phpfreaks.com/topic/59232-counting-in-tables/#findComment-294224 Share on other sites More sharing options...
Yesideez Posted July 10, 2007 Share Posted July 10, 2007 To pull only one of many of the same items from the table use DISTINCT() SELECT DISTINCT(`id`) FROM table You could use switch() on something like the `id` to link to an image stored on the server. Link to comment https://forums.phpfreaks.com/topic/59232-counting-in-tables/#findComment-294230 Share on other sites More sharing options...
supanoob Posted July 10, 2007 Author Share Posted July 10, 2007 ive sorted it thanks Link to comment https://forums.phpfreaks.com/topic/59232-counting-in-tables/#findComment-294238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.