-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcity.php
More file actions
47 lines (43 loc) · 1.02 KB
/
Copy pathcity.php
File metadata and controls
47 lines (43 loc) · 1.02 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
$username = "root";
$password = "";
$hostname = "localhost";
$database = "wallethub";
$conn = mysql_connect($hostname,$username,$password) or die('connection error');
mysql_select_db($database) or die('database not found');
$json = array();
$citess = array();
if($_REQUEST['action']=='load_city_pop')
{
$searchstr = $_REQUEST['str'];
$myquery = "SELECT location, slug
FROM `population`
WHERE slug LIKE '".$searchstr."%'
ORDER BY population DESC
LIMIT 0 , 10";
$row = mysql_query($myquery);
if(!$row)
{
$json['result'] = 'no';
}
else
{
while($data = mysql_fetch_array($row,MYSQL_ASSOC))
{
//echo '<pre>';
//print_r($data);
if(!empty($data))
{
$citess[] = $data;
// $json['result'] = 'yes';
}
else
{
//$json['result'] = 'no';
}
}
$json=$citess;
}
echo json_encode($json);
}
?>