예제 #1
0
파일: track.php 프로젝트: runderwood/obfind
 public static function find($num)
 {
     $sql = 'select id,sid,tflag,address,tag from track where sid=?';
     return Rudb::get_one($sql, self::hashnum($num));
 }
예제 #2
0
 public static function find_tagged($tag, $add, $num = 1)
 {
     $r = self::find_address($add);
     if ($r) {
         $r = (object) $r;
     } else {
         return false;
     }
     $o = (int) $num - 1;
     $c = Rudb::connection();
     $sql = 'select t.address as address, ST_AsText(t.location) as loc,' . ' ST_Distance(' . '   ST_Transform(t.location,3857),' . '   ST_Transform(ST_GeometryFromText(' . $c->quote($r->approx_loc) . ',4326),3857)) as dist' . ' from track t' . '   where t.tag = ? and t.tflag = \'at\'' . ' order by dist asc limit 1';
     if ($o) {
         $sql .= ' offset ' . $o;
     }
     $r = Rudb::get_one($sql, $tag);
     if ($r) {
         $r = $r['address'];
     }
     return $r;
 }