forked from code-for-india/cfi-lightning
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nearby.php
36 lines (31 loc) · 980 Bytes
/
nearby.php
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
<?php ob_start(); ?>
<?php include('config.php') ?>
<?php
session_start();
$max1 = $max2 = $max3 = 0;
for ($x = 3; $x < 21; $x++) {
$query = "SELECT * FROM zavala1 WHERE ID ='$x'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
if ($row[12][0] > $max1)
$max1 = $x;
else if ($row[12][0] > $max2)
$max2 = $x;
else if ($row[12][0] > $max3)
$max3 = $x;
}
$arr = array (400);
$query = "SELECT * FROM zavala1 WHERE ID ='$max1'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$arr[0] = array($row[1], $row[3][0], $row[11][0]);
$query = "SELECT * FROM zavala1 WHERE ID ='$max2'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$arr[1] = array($row[1], $row[3][0], $row[11][0]);
$query = "SELECT * FROM zavala1 WHERE ID ='$max3'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$arr[2] = array($row[1], $row[3][0], $row[11][0]);
echo(json_encode($arr));
?>