browolf Posted July 3, 2009 Posted July 3, 2009 (edited) i dont do php often and when i do it's by cobbling together samples from all over using a generic knowledge of scripting and reading the manual. this is beyond cobbling. a 3 dimensional (i think) array with 2 normal ones and an associative one. all i want is the name fields outputted to a webpage. simple really but I'm a bit lost here. extreme brain strain the print_r gives this Array ( [words] => Array ( [2009-07-03] => Array ( [0] => Array ( [query] => "Sarah" [name] => Sarah ) [1] => Array ( [query] => "michael" [name] => michael ) [2] => Array ( [query] => Alaska [name] => Alaska ) ) ) [as_of] => 1246663258 ) help!! thx Edited July 4, 2009 by browolf
browolf Posted July 4, 2009 Author Posted July 4, 2009 never mind. just figured it out when i discovered a function called "key" and experimenting in xampp.
powdarrmonkey Posted July 4, 2009 Posted July 4, 2009 foreach( $origarray['words']['2009-07-03'] as $thing ) { echo " name: {$thing['name']}\n"; } Or perhaps: foreach( $origarray['words'] as $days ) { foreach( $days as $day ) { foreach( $day as $thing ) { echo " name: {$thing['name']}\n"; } } }
browolf Posted July 4, 2009 Author Posted July 4, 2009 thx anyways. I spent about 3 hours earlier figuring it out lol. what i've done is $keydate = key($decode["words"]); $count = count($decode["words"][$keydate]); //counting the number of status $strdmp=""; for($i=0;$i<$count;$i++){ //echo $decode["words"][$keydate][$i][name]." "; $strdmp = $strdmp . $decode["words"][$keydate][$i][name]." "; }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now