mkosmosports Posted January 15, 2007 Share Posted January 15, 2007 HeyI have a multidimensional array.Array ( [0] => Array ( [dt] => 200701 [tid] => 46 [gid] => 3 ) [1] => Array ( [dt] => 200611 [tid] => 19 [gid] => 1 ) [2] => Array ( [dt] => 200611 [tid] => 79 [gid] => 5 ) [3] => Array ( [dt] => 200610 [tid] => 20 [gid] => 1 ) [4] => Array ( [dt] => 200609 [tid] => 14 [gid] => 1 ) [5] => Array ( [dt] => 200609 [tid] => 253 [gid] => 1 ) [6] => Array ( [dt] => 200609 [tid] => 46 [gid] => 3 ) [7] => Array ( [dt] => 200609 [tid] => 20 [gid] => 1 ) [8] => Array ( [dt] => 200609 [tid] => 16 [gid] => 1 ) [9] => Array ( [dt] => 200609 [tid] => 21 [gid] => 2 ) [10] => Array ( [dt] => 200609 [tid] => 62 [gid] => 5 )How can I retrieve [tid] and [gid] values based on what the [dt] value is? Ie. I want to find out what [tid] and [gid] is if [dt] = 200609.....This must be a simple thing , Im just not understanding the structure of the multidimensional array....Thanks for your help! Quote Link to comment Share on other sites More sharing options...
utexas_pjm Posted January 15, 2007 Share Posted January 15, 2007 [code]<?phpforeach($array as $node){ if($node['dt'] == 200609) echo $node['gid'];}?>[/code] Quote Link to comment Share on other sites More sharing options...
mkosmosports Posted January 15, 2007 Author Share Posted January 15, 2007 That makes sense, using a loop. For some reason I thought since a complete array is in memory, I wouldnt need a loop to retrieve values. Ah, it sucks being a beginner!Thanks bro! 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.