bug #261
This commit is contained in:
parent
e040dbdd74
commit
cebdd27830
1 changed files with 11 additions and 1 deletions
|
@ -75,12 +75,22 @@ document.f.location.focus();
|
||||||
$locid = intval($_REQUEST['location']);
|
$locid = intval($_REQUEST['location']);
|
||||||
$query = "select * from `locations` where `id`='$locid'";
|
$query = "select * from `locations` where `id`='$locid'";
|
||||||
$loc = mysql_fetch_assoc(mysql_query($query));
|
$loc = mysql_fetch_assoc(mysql_query($query));
|
||||||
|
if($maxdist <= 10)
|
||||||
|
{
|
||||||
|
$query = "SELECT ROUND(6378.137 * ACOS((SIN(PI() * $loc[lat] / 180) * SIN(PI() * `locations`.`lat` / 180)) + (COS(PI() * $loc[lat] / 180 ) *
|
||||||
|
COS(PI() * `locations`.`lat` / 180) * COS(PI() * `locations`.`long` / 180 - PI() * $loc[long] / 180))), -1) AS `distance`,
|
||||||
|
`locations`.`name` AS `location`, concat(`users`.`fname`, ' ', LEFT(`users`.`lname`, 1)) AS `name`, `long`, `lat`,
|
||||||
|
`users`.`id` as `uid`, `contactinfo` FROM `locations`, `users`, `notary` WHERE `users`.`locid` = `locations`.`id` AND
|
||||||
|
`users`.`id` = `notary`.`to` AND `users`.`listme` = 1 GROUP BY `notary`.`to`
|
||||||
|
HAVING SUM(`notary`.`points`) >= 100 AND `distance` <= '$maxdist' ORDER BY `distance`";
|
||||||
|
} else {
|
||||||
$query = "SELECT ROUND(6378.137 * ACOS((SIN(PI() * $loc[lat] / 180) * SIN(PI() * `locations`.`lat` / 180)) + (COS(PI() * $loc[lat] / 180 ) *
|
$query = "SELECT ROUND(6378.137 * ACOS((SIN(PI() * $loc[lat] / 180) * SIN(PI() * `locations`.`lat` / 180)) + (COS(PI() * $loc[lat] / 180 ) *
|
||||||
COS(PI() * `locations`.`lat` / 180) * COS(PI() * `locations`.`long` / 180 - PI() * $loc[long] / 180))), -1) AS `distance`,
|
COS(PI() * `locations`.`lat` / 180) * COS(PI() * `locations`.`long` / 180 - PI() * $loc[long] / 180))), -1) AS `distance`,
|
||||||
`locations`.`name` AS `location`, concat(`users`.`fname`, ' ', LEFT(`users`.`lname`, 1)) AS `name`, `long`, `lat`,
|
`locations`.`name` AS `location`, concat(`users`.`fname`, ' ', LEFT(`users`.`lname`, 1)) AS `name`, `long`, `lat`,
|
||||||
`users`.`id` as `uid`, `contactinfo` FROM `locations`, `users`, `notary` WHERE `users`.`locid` = `locations`.`id` AND
|
`users`.`id` as `uid`, `contactinfo` FROM `locations`, `users`, `notary` WHERE `users`.`locid` = `locations`.`id` AND
|
||||||
`users`.`id` = `notary`.`to` AND `users`.`listme` = 1 GROUP BY `notary`.`to`
|
`users`.`id` = `notary`.`to` AND `users`.`listme` = 1 GROUP BY `notary`.`to`
|
||||||
HAVING SUM(`notary`.`points`) >= 100 AND `distance` <= '$maxdist' ORDER BY `distance` LIMIT 50";
|
HAVING SUM(`notary`.`points`) >= 100 AND `distance` <= '$maxdist' ORDER BY `distance` LIMIT 50";
|
||||||
|
}
|
||||||
$res = mysql_query($query);
|
$res = mysql_query($query);
|
||||||
?><table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="700">
|
?><table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="700">
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in a new issue