Passing Results from SQL to Google Maps API in CodeIgniter
- by Jason Shultz
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);
}
How can I output the info to the google maps api correctly so that it display’s the map appropriately?
The API interface takes the results like this: $marker['address'] = 'Crescent Park, Palo Alto';