-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfilldb.php
More file actions
21 lines (19 loc) · 763 Bytes
/
filldb.php
File metadata and controls
21 lines (19 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
require_once 'common.php';
$fp = fopen('US.txt','r');
while(!feof($fp)){
$line = fgets($fp);
$line = explode("\t", $line);
$values = array();
$values['id'] = $line[0];
$values['name'] = "'".$line[1]."'";
$values['latitude'] = deg2rad($line[4]);
$values['longitude'] = deg2rad($line[5]);
$values['latitude_deg'] = $line[4];
$values['longitude_deg'] = $line[5];
$values['feature_code'] = "'".$line[7]."'";
$values['country_code'] = "'".$line[8]."'";
$values['state_code'] = "'".$line[10]."'";
$ln_sph->exec("INSERT INTO geodemo(id,name,latitude,longitude,latitude_deg,longitude_deg,feature_code,country_code,state_code) VALUES(".implode(',',$values).")");
}
fclose($fp);