PHP教程

漏刻有时多功能php-API接口开发实例

本文主要是介绍漏刻有时多功能php-API接口开发实例,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
  /*06.疑难点位管理*/
    function getDifficult()
    {
        global $db, $res;
        dbc();
        @$poi_address = get_param("poi_address");
        @$poi_sn = get_param("poi_sn");
        @$poi_ins5 = $_GET["poi_ins5"];
        @$p = $_GET['page'] == "" ? 1 : $_GET['page'];//获取用户选择的页码
        @$pagesize = $_GET['limit'] == "" ? 15 : $_GET['limit'];//获取用户选择的每页显示多少条数据
        @$limit = ($p - 1) * $pagesize;//偏移量

        $sql = "select a.main_id,a.poi_id,a.poi_sn,a.poi_name,a.poi_address,a.poi_difficult,a.poi_md,from_unixtime(a.poi_brdown) as poi_brdown,b.poi_id,b.poi_ins1,b.poi_ins2,b.poi_ins3,b.poi_ins4,b.poi_bdlng AS poi_lon,b.poi_bdlat AS poi_lat from " . $db->table('maintain') . " AS a," . $db->table('poi') . " AS b WHERE a.poi_id = b.poi_id";
        $sql .= " AND a.poi_difficult = 1";
        //编号和名称搜索;
        IF ($poi_sn != "") {
            $sql .= " AND (a.poi_name like '%" . $poi_sn . "%' OR a.poi_sn like '%" . $poi_sn . "%')";
        }

        IF ($poi_ins5 != "") {
            $sql .= " AND a.poi_ins5 ='" . $poi_ins5 . "'";
        }
        $sql .= " ORDER BY a.main_id DESC LIMIT " . $limit . "," . $pagesize;
        $row = $db->queryall($sql);

        $sql_c = "select a.main_id,a.poi_id,a.poi_sn,a.poi_name,a.poi_address,a.poi_difficult,from_unixtime(a.poi_brdown) as poi_brdown,b.poi_id,b.poi_ins1,b.poi_ins2,b.poi_ins3,b.poi_ins4 from " . $db->table('maintain') . " AS a," . $db->table('poi') . " AS b WHERE a.poi_id = b.poi_id";
        $sql_c .= " AND a.poi_difficult = 1";
        //编号和名称搜索;
        IF ($poi_sn != "") {
            $sql_c .= " AND (a.poi_name like '%" . $poi_sn . "%' OR a.poi_sn like '%" . $poi_sn . "%')";
        }

        IF ($poi_ins5 != "") {
            $sql_c .= " AND a.poi_ins5 ='" . $poi_ins5 . "'";
        }
        $sql_c .= " ORDER BY a.main_id DESC LIMIT " . $limit . "," . $pagesize;
        $row_c = $db->queryall($sql_c);

        $res['code'] = 0;
        $res['count'] = count($row_c);
        $res["data"] = $row;
        die(json_encode_lockdata($res));
    }

Lockdatav Done!

这篇关于漏刻有时多功能php-API接口开发实例的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!