I'm hoping to use Google Maps on my site.
My addresses are stored in a DB. I’m pulling up a page where the information is all dynamic. For example: mysite.com/site/business/5 (where 5 is the id of the business).
Let’s say I do a query like this:
function addressForMap($id) {
$this->db->select('b.id, b.busaddress, b.buscity, b.buszip');
$this->db->from('business as b');
$this->db->where('b.id', $id);
$this->db->limit(1);
// add a limit $this->db->limit(1);
// get the results.. cha-ching
$q = $this->db->get();
// any results?
if($q->num_rows() !== 1)
{
return FALSE;
}
return $q->row();
}
How can I output the info to the Google Maps API correctly so that it displays the map appropriately?
The API interface takes the results like this: $marker['address'] = 'Crescent Park, Palo Alto';
.
Here's what I have in the controller:
$marker = array();
$address = $this->Business_model->addressForMap($id); //Get result row
$marker['address'] = $address->busaddress .' '.$address->buscity .', '. $address->buszip;