-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
29 lines (24 loc) · 870 Bytes
/
Copy pathtest.php
File metadata and controls
29 lines (24 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/**
* Created by PhpStorm.
* User: Srinivas
* Date: 5/6/2016
* Time: 12:34 AM
*/
$hn='localhost';
$db='clientopolyidx';
$un='root';
$pw='root';
// select city list from the stats_geo table
$conn = new mysqli($hn, $un, $pw, $db);
$query_city = "SELECT distinct trim(zip),trim(city),trim(county),trim(state) FROM residential order by zip";
$result_city = $conn->query($query_city);
while($data=mysqli_fetch_array($result_city, MYSQLI_NUM)) {
//insert into statistics_listings
$query = "INSERT INTO statistics_listings SELECT 'id','$data[0]',zip,city,county,state,count(zip),avg(listprice),min(listprice),max(listprice),now(),'1','0' from residential where city='$data[1]' and zip='$data[2]'and status='Active'";
$result = $conn->query($query);
if(!$result) die($conn->error);
if($result)
echo "insert successful";
}
$conn->close();