Pupe Posted May 24, 2013 Share Posted May 24, 2013 please answer this question in php.. I need three arrays,One with shops, second with other instruments, and the third with the links between them. For example: $instruments = array(array(1,"Guitar"),array(2,"Drums")); $stores = array(array(5,"My Store"),array(10,"Your store")); $connections = array(array(1,5),array(1,10),array(2,5)); Then, based on the variable defined in the program, for example: $search="Guitar"; Then must do this,need to find a shop where the requested instrument. First, from the first series download id instrument (for example, the guitar has id 1). Then, from the $ connections and find all the shops where there is (that are members of the 0 and 1, respectively, shop with IDs 5 and 10) Finally, from the $ stores, download, store names (in this example are 5 and 10). Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/ Share on other sites More sharing options...
requinix Posted May 24, 2013 Share Posted May 24, 2013 PHPFreaks.com Questions, Comments, & Suggestions This is NOT a help forum! Do not post topics asking for help that are not related to the website. Are you getting these arrays from a database? Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432155 Share on other sites More sharing options...
Q695 Posted May 25, 2013 Share Posted May 25, 2013 you probably are thinking a while ($row=...) Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432163 Share on other sites More sharing options...
Pupe Posted May 25, 2013 Author Share Posted May 25, 2013 Are you getting these arrays from a database? no it is assignment in my class(school),,no database clearly class assignment. Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432228 Share on other sites More sharing options...
Jessica Posted May 25, 2013 Share Posted May 25, 2013 This forum is not for help with your homework. But if you make an effort we might be able to help you. We won't do it for you. Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432240 Share on other sites More sharing options...
jazzman1 Posted May 25, 2013 Share Posted May 25, 2013 Is there a problem using an array(s) like: $instuments = array(array(1 => "Guitar"),array(2 => "Drums")); 1, it should be the key (id), the Guitar is gonna be the value. Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432270 Share on other sites More sharing options...
Pupe Posted May 26, 2013 Author Share Posted May 26, 2013 can you resolve all code here.. Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432337 Share on other sites More sharing options...
requinix Posted May 26, 2013 Share Posted May 26, 2013 can you resolve all code here..You might have missed it. Let me quote it here for you so you don't need to scroll up: [I]f you make an effort we might be able to help you. We won't do it for you. Write something yourself. Try it. If it doesn't work then come back, post the code, and tell us how is it not working. Then we'll give you suggestions on how to change it. Rinse and repeat. Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432343 Share on other sites More sharing options...
jazzman1 Posted May 26, 2013 Share Posted May 26, 2013 And the most important thing, don't forget to post out your solution to the forum Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432351 Share on other sites More sharing options...
jazzman1 Posted May 26, 2013 Share Posted May 26, 2013 (edited) Tip: Maping (array_map) $instruments and $connections and find out the commons indexes between them, then loop $connections through the second indexes and match them in $stores. Edited May 26, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432354 Share on other sites More sharing options...
Pupe Posted May 26, 2013 Author Share Posted May 26, 2013 i don t know how to code, i am beginer.... Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432359 Share on other sites More sharing options...
Jessica Posted May 26, 2013 Share Posted May 26, 2013 Isn't that why you're taking a CLASS on it? Quote Link to comment https://forums.phpfreaks.com/topic/278369-help-arrays/#findComment-1432363 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.