Source of file BatchGeoAddressConverter.php
Size: 1,578 Bytes - Last Modified: 2021-12-23T10:41:51+00:00
/var/www/docs.ssmods.com/process/src/code/converters/BatchGeoAddressConverter.php
12345678910111213141516171819202122232425262728293031323334353637383940414243 | <?php /** * here is some old code that maybe of use. * * */ class BatchGeoAddressConverter extends Object { /* static function convert($tableName, $fieldName, $idFieldName, $params) { $data = self::getDataFromTable($tableName, $fieldName, $idFieldName); foreach($data as $row) { print_r($row); $address = str_replace('?', " ", $row[$fieldName]); if($address) { echo "checking ".$address."<hr />"; $newAddress = GetLatLngFromGoogleUsingAddress::get_placemark_as_array($address, true, $params); if($newAddress["1"] || $newAddress[0] || $newAddress["address"]) { $sql = 'UPDATE \"'.$tableName.'\" SET \"'.$fieldName.'\" = "'.addslashes($newAddress["address"]).'" WHERE \"'.$idFieldName.'\" = "'.$row[$idFieldName].'" LIMIT 1;'; mysql_query($sql); echo "<hr />".$sql."<hr />"; } echo "**********************<BR />"; $sql = "UPDATE \"".$tableName."\" SET \"DONE\" = 1 WHERE \"".$idFieldName."\" = '".$row[$idFieldName]."' LIMIT 1;"; mysql_query($sql); } } die("test"); } static function getDataFromTable($tableName, $fieldName, $idFieldName) { $sqlQuery = new SQLQuery(); $sqlQuery->select = array($fieldName, $idFieldName); $sqlQuery->where = array("DONE <> 1"); $sqlQuery->from = Array($tableName); $result = $sqlQuery->execute(); return $result; } */ } |