-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajaxDropdown.php
More file actions
31 lines (25 loc) · 927 Bytes
/
ajaxDropdown.php
File metadata and controls
31 lines (25 loc) · 927 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
30
31
<?php
$con = mysqli_connect("localhost", "root", "root", "zomato");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if (isset($_GET['searchitem']) && isset($_GET['real_city'])) {
$result = mysqli_query($con, "SELECT * FROM metros where name LIKE \"%".$_GET['searchitem']."%\" and real_city LIKE \"%".$_GET['real_city']."%\"");
echo '<div>';
while ($row = mysqli_fetch_array($result)) {
//echo $row['latitude'] . " " . $row['longitude'];
//echo "<br>";
echo '<p id="' . $row['metro_id'] . '" data-values=\'{"metro_id":"'
. $row['metro_id'] . '", "latitude":"'
. $row['latitude'] . '", "longitude":"'
. $row['longitude'] . '"}\'><a onclick="locationLoad(this)">'
. $row['name'] . '</a></p>';
}
echo '</div>';
}
else
{
echo 'unable to process request';
}
mysql_close($con);