if ($mysqli->connect_errno):
die(‘Connect Error: ’ . $mysqli->connect_errno);
endif;
$mysqli->set_charset(‘utf8’);
//set filename
$filename = “Filename as of - ( “.date(“M-d-Y”). ” ).xls”;
$header = “entry_id\t”;
$header .= “firstname\t”;
$header .= “lastname\t”;
$header .= “company\t”;
$header .= “phone\t”;
$header .= “email\t”;
$header .= “address\t”;
$header .= “city\t”;
$header .= “state\t”;
$header .= “zip\t”;
$header .= “date_created\t”;
// set xls header
header(‘Content-type: application/octet-stream’);
header(“Content-type: application/x-msdownload”);
header(“Content-type: application/vnd.ms-excel”);
header(“Content-Disposition: attachment; filename=$filename”);
header(“Pragma: no-cache”); // HTTP/1.0
header(“Cache-Control: no-cache, must-revalidate”); // HTTP/1.1
header(“Expires: Sat Jun 27 23:25:37 PDT 2009”); // set a date in the past
print $header;
$sql = “SELECT * FROM table_name ORDER BY date_created”;
$result = $mysqli->query($sql);
while ($row = $result->fetch_row()) {
echo “\n”;
foreach ($row as $key => $field) {
$field = str_replace(“\n”,” “,$field);
$field = str_replace(“\r”,” “,$field);
echo $field . “\t”;
}
}
$mysqli->close();
?>
“SET NAMES utf8”)); $select = $dbh->prepare(“SELECT * FROM locations WHERE lat = ” AND lng = ””); // prepare select statement $update = $dbh->prepare(“UPDATE locations SET lat = :lat, lng = :lng WHERE id = :id”); // prepare update statement $select->execute(); $result = $select->fetchAll(PDO::FETCH_ASSOC); for ($i = 0; $i results[0]->geometry->location->lat; $lng = $output->results[0]->geometry->location->lng; $update->execute(array(“:lat” => $lat, “:lng” => $lng, “:id” => $id)); usleep(0.5*1000000); // OVER_QUERY_LIMIT, sleep for 1/2 sec } echo ‘
';
echo 'incomplete: ';
$select->execute();
$result = $select->fetchAll(PDO::FETCH_ASSOC);
$result = empty($result) ? "all done!" : $result;
print_r($result);
echo '’;
?>
If you like this script, please follow or like to keep development active!