deezy Posted December 4, 2008 Share Posted December 4, 2008 Hello! I have a php / mysql problem that I am struggling to find the best method for. The basic structure of my two tables is as follows: Selection id | Name | selections --------------------------- 1 | User1 | 12,16,22,34 2 | User2 | 2,17,66,69 Products id | Product | ------------- 4 | Prod1 | 5 | Prod2 | My page consists of a dropdown field (containing 'Name'), when a name is selected i need to use the php explode function to loop through the 'selections' and return the product names that the selected user has ordered. Is there a way to achieve this without adding any more tables as i really just need a quick fix. Thanks! Quote Link to comment Share on other sites More sharing options...
laPistola Posted December 4, 2008 Share Posted December 4, 2008 write a new mysql query for the selection and use the IN in the where clause eg WHERE product IN (" . $row['selections'] . ") by taking the string from selections directly into the brakets you dont need to explode. 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.