|< 1 2 3 >| | 27 Einträge, 3 Seiten |
1
2
3
4
5
6
my $B1 = 7.2167121725093;
my $L1 = 51.4840049423119;
my $erdradius = 6378.388;
my $prepare_sth = "select primarykey, name from defaultusers where status = 'N' and ";
$prepare_sth .= "(ACOS((SIN(RADIANS($B1))*SIN(RADIANS(lat))) + (COS(RADIANS($B1))*COS(RADIANS(lat))*COS(RADIANS(lon)-RADIANS($L1)))) * $erdradius) <= 100";
1
2
3
my $get_insertions = $dbh->prepare("SELECT `inserate`.*, `users`.`postleitzahl`, `users`.`vorname`, `plz_coords`.`stadt`, (6378.137 * ACOS(sin(`plz_coords`.`lat_rad`) * SIN(?) + COS(`plz_coords`.`lat_rad`) * COS(?) * cos(? - `plz_coords`.`long_rad`))) AS `distance` FROM `users` `users`, `inserate`, `plz_coords` WHERE `users`.`postleitzahl` = `plz_coords`.`plz` AND `inserate`.`user` = `users`.`id` AND `inserate`.`art` = ? AND (6378.137 * ACOS(sin(`plz_coords`.`lat_rad`) * SIN(?) + COS(`plz_coords`.`lat_rad`) * COS(?) * cos(? - `plz_coords`.`long_rad`))) < 50 ORDER BY distance;");
$get_insertions->execute($$coordsref{'lat_rad'}, $$coordsref{'lat_rad'}, $$coordsref{'long_rad'}, ($$params{'art'} eq 'biete' ? 'suche' : 'biete'), $$coordsref{'lat_rad'}, $$coordsref{'lat_rad'}, $$coordsref{'long_rad'});
1
2
3
4
5
6
7
8
9
10
CREATE TABLE plz_coords (
plz varchar(5) NOT NULL default '',
stadt varchar(255) NOT NULL default '',
lat_rad float NOT NULL default '0',
long_rad float NOT NULL default '0',
lat float NOT NULL default '0',
`long` float NOT NULL default '0',
PRIMARY KEY (plz)
) TYPE=MyISAM;
$lat_rad = $lat_rad * $pi / 180;
|< 1 2 3 >| | 27 Einträge, 3 Seiten |