Re: problem with array
| From: | Jim Lucas | Date: | Sun, 15 Jul 2007 19:13:47 +0000 |
| Subject: | Re: problem with array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-258882@lists.php.net to get a copy of this message | ||
Ross wrote:
I am using postcode anywhere for a 'where's my nearest' function. All the geographical info is contained in an array, which when dumped looks like this var_dump ($result); array(1) { [0]=> array(13) { ["origin_postcode"]=> string(7) "EH2 2BE" ["destination_postcode"]=> string(6) "EH2 2BE" ["distance"]=> string(3) "0.0" ["id"]=> string(1) "1" ["description"]=> string(8) "good man" ["grid_east_m"]=> string(6) "326513" ["grid_north_m"]=> string(6) "675115" ["longitude"]=> string(17) "-3.17731851516552" ["latitude"]=> string(16) "55.9634587262473" ["os_reference"]=> string(14) "NT 26513 75115" ["wgs84_longitude"]=> string(17) "-3.17876048499117" ["wgs84_latitude"]=> string(16) "55.9634451567764" ["name"]=> string(12) "Jim Smith" } } however, when I try and echo out a single index by name I get an undefined index. echo $result["description"]; I can't seem to extract the bits I want from it. Thanks, R.Access this like this echo $result[0]['description']; notice the sub-array... -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare