Welcome Guest, Not a member yet? Register   Sign In
Loading custom libraries
#5

[eluser]skaterdav85[/eluser]
So I am having a problem with my foreach loop. I added a custom library called RemoteConnector. In my model, I am retreiving a list of addresses from a table in my database and looping over each address and geocoding that address with the tiny geocoder webservice and my RemoteConnector library, all of which is happening in my model. Just for testing, I am echoing out each address and its coordinates in my model, and for some reason, the coordinates are all the same for every address. I have a feeling this has something to do with using the same instance of my RemoteConnector object, because the coordinates being echoed out are all the same from the first address.

Here is some of my code. My database result set is stored in a property called 'address' which im looping over in this foreach loop to get the coordinates:

Code:
foreach($this->address as $showLocation){    
            //now geocode each showLocation
            $address = urlencode($showLocation);
            $url = array("url"=>"http://tinygeocoder.com/create-api.php?q=$address");
            $this->load->library('RemoteConnector', $url);
            $coord = $this->remoteconnector->__toString(); //get the string contents of the remote file
            echo $showLocation." | ".$coord."\n";
}


Messages In This Thread
Loading custom libraries - by El Forum - 10-12-2010, 08:50 PM
Loading custom libraries - by El Forum - 10-12-2010, 11:16 PM
Loading custom libraries - by El Forum - 10-12-2010, 11:31 PM
Loading custom libraries - by El Forum - 10-12-2010, 11:48 PM
Loading custom libraries - by El Forum - 10-12-2010, 11:58 PM
Loading custom libraries - by El Forum - 10-13-2010, 12:14 AM
Loading custom libraries - by El Forum - 10-13-2010, 12:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB