i have a bigger issue with a foreach() Loop and the Google Maps API class.
Currently i have 1500 datasets in my MySQL Table, i sort them out by “latitude IS NULL”.
Then i want to foreach() them and call the Google Maps API (KM6_Geo) each time and Save the new geocodes to the MySQL Database.
After about 250/300 Calls / Updates my Server replies with an “timeout”.
Now this is my current script:
foreach(KM6_Addresses::getGeoCodes() as $item): $geocode = KM6_Geo::generate($item['street'].' '.$item['zipcode'].' '.$item['city']); $data = array( 'lat' => $geocode['lat'], 'lng' => $geocode['lon'] ); $where = array('company_id' => $item['company_id']); KM6_Addresses::updateGeoCode($data,$where); endforeach;
Now my Question:
How can i foreach() with packages or something like that. So i do not try to update 1500 data sets.
Maybe someone can help me out.