Welcome Guest, Not a member yet? Register   Sign In
Multidimensional array generate
#1

[eluser]karloff[/eluser]
Hi,

i'm trying to create a search feature which bring back results of how close you are to a particular place. my problem is that I need to add the info of each place into a multidimensional array, with the added field of the distance, so i can sort it....

this is my code so far but It keep generating php errors,

Is this possible or am i going about it the wrong way?



Code:
$item = $this->cfmmodel->get_all_places();
$postcode = $this->cfm_lib->clean_postcode($_POST['postcode']);
$long = $this->postcodemodel->getLong($postcode);
$lat = $this->postcodemodel->getLat($postcode);

$data['multi'] = Array(
                    foreach ($items as $item)
                    {
                    
                    array(
                   'id' => $item->id,
                   'name' => $item->name,
                   'distance' => $this->cfm_lib->getDistance($lat[0]->Lat, $long[0]->Long, $item->Lat, $item->Long),
                    ),

                }
                );


Messages In This Thread
Multidimensional array generate - by El Forum - 07-12-2009, 12:41 PM
Multidimensional array generate - by El Forum - 07-12-2009, 01:33 PM
Multidimensional array generate - by El Forum - 07-12-2009, 02:17 PM
Multidimensional array generate - by El Forum - 07-12-2009, 03:10 PM
Multidimensional array generate - by El Forum - 07-12-2009, 03:10 PM
Multidimensional array generate - by El Forum - 07-12-2009, 03:11 PM
Multidimensional array generate - by El Forum - 07-12-2009, 03:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB