Last change
on this file since 9039 was 9028, checked in by dennisw, 14 years ago |
django_gheat - bezig met generate_tiles script
|
File size:
907 bytes
|
Rev | Line | |
---|
[9006] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | // edit with personal settings
|
---|
[9028] | 4 | $location = '127.0.0.1';
|
---|
| 5 | $username = 'root';
|
---|
| 6 | $password = 'password';
|
---|
| 7 | $database = 'project_heatmap';
|
---|
[9006] | 8 |
|
---|
| 9 | // connect to database
|
---|
| 10 | mysql_connect($location, $username, $password)
|
---|
| 11 | or die("Error connecting to mysql: " . mysql_error());
|
---|
| 12 | mysql_select_db($database)
|
---|
| 13 | or die("Error connecting to database: " . mysql_error());
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | foreach($filelist as $file) {
|
---|
| 18 |
|
---|
[9028] | 19 | $table = "gheat_meting";
|
---|
[9006] | 20 |
|
---|
[9028] | 21 | if (($handle = fopen("wleiden.csv", "r")) !== FALSE) {
|
---|
[9006] | 22 | while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) {
|
---|
| 23 | $lat=str_replace("N ", "", $data[0]);
|
---|
| 24 | $lon=str_replace("E ", "", $data[1]);
|
---|
| 25 | $ssid=str_replace("'", "", $data[2]);
|
---|
| 26 | $enc = substr($data[8], -2, 1);
|
---|
[9028] | 27 | $query=mysql_query("INSERT INTO ".$table." (lat, long) VALUES ('$lat','$lon')");
|
---|
[9006] | 28 | if (!$query) {
|
---|
| 29 | die('Invalid query: ' . mysql_error());
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 | fclose($handle);
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[9028] | 37 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.