wemustdesign Posted November 15, 2010 Share Posted November 15, 2010 Hi, I have a database that is going to contain recepies and ingredients tables. The recipe table is going to store the ingredients like this: 1,5,6,8 This refers to the table ingredients id. I now want to explode these vaules and count them up so they can be outputted like this: sugar (2) honey(1) flour (3) I have no idea of how to count all of the exploded id's and ouput them like above Quote Link to comment https://forums.phpfreaks.com/topic/218709-explode-question/ Share on other sites More sharing options...
laffin Posted November 15, 2010 Share Posted November 15, 2010 I think u should give thought about the design of the db before making a db that becomes inflexible later on. there is no need to store all the recipes ingredients in the same table, if u design your db for flexibility in for the long run. as most of what your asking SQL can already handle Recipe Table: id Name Description Instructions Ingredients id Name RecipeIngredients RecipeId IngredientID Amount with those 3 tables, I can do exactly wut u need all within sql Quote Link to comment https://forums.phpfreaks.com/topic/218709-explode-question/#findComment-1134338 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.