Re: problem with array
| From: | Al | Date: | Sun, 15 Jul 2007 18:44:46 +0000 |
| Subject: | Re: problem with array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-258881@lists.php.net to get a copy of this message | ||
Do a print_r($result); and you'll see the problem.
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.