当前位置: 首页>>代码示例>>PHP>>正文


PHP Store::get_by_sql方法代码示例

本文整理汇总了PHP中Store::get_by_sql方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::get_by_sql方法的具体用法?PHP Store::get_by_sql怎么用?PHP Store::get_by_sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Store的用法示例。


在下文中一共展示了Store::get_by_sql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: acos

$sql .= "     ( 6371 * acos( cos( radians(" . $userlatitude . ") ) ";
$sql .= "                    * cos( radians( " . C_STORE_LATITUDE . " ) ) ";
$sql .= "                    * cos( radians( " . C_STORE_LONGITUDE . " ) ";
$sql .= "                        - radians(" . $userlongitude . ") ) ";
$sql .= "                    + sin( radians(" . $userlatitude . ") ) ";
$sql .= "                    * sin( radians( " . C_STORE_LATITUDE . " ) ) ";
$sql .= "                  ) ";
$sql .= "    ) AS distance ";
$sql .= " FROM " . T_STORES . " ";
$sql .= " HAVING distance < " . $distance . " ";
$sql .= " AND WHERE " . $where . " ";
$sql .= " ORDER BY distance ASC";
if (isset($_GET['userlongitude']) && isset($_GET['userlatitude']) && $_GET['userlongitude'] != "" && $_GET['userlongitude'] != "0" && $_GET['userlatitude'] != "" && $_GET['userlatitude'] != "0") {
    $items = Store::get_by_sql($sql);
} else {
    $items = Store::get_by_sql("SELECT * FROM " . T_STORES . " WHERE " . $where . $sort . $limit);
}
$filename = 0;
foreach ($items as $item) {
    $item->distance = round($item->distance) > 0 ? round($item->distance) + "km" : round($item->distance / 0.001) + "m";
    $sql = "SELECT * FROM traffics WHERE storeid = " . $item->id;
    if (!isset($_GET['1hour'])) {
        $sql .= " AND " . C_TRAFFIC_DATETIME . " BETWEEN DATE_SUB(NOW(), INTERVAL 1 HOUR) AND NOW()";
    }
    $traffics = Traffic::get_by_sql($sql);
    $totaltraffics = 0;
    $lasttrafficdatetime = 0;
    if (count($traffics) > 0) {
        foreach ($traffics as $traffic) {
            $totaltraffics += $traffic->status;
        }
开发者ID:NemOry,项目名称:EpicueWebPanel,代码行数:31,代码来源:getstores.php

示例2:

    if ($searchOper == 'eq') {
        $searchString = $searchString;
    }
    if ($searchOper == 'bw' || $searchOper == 'bn') {
        $searchString .= '%';
    }
    if ($searchOper == 'ew' || $searchOper == 'en') {
        $searchString = '%' . $searchString;
    }
    if ($searchOper == 'cn' || $searchOper == 'nc' || $searchOper == 'in' || $searchOper == 'ni') {
        $searchString = '%' . $searchString . '%';
    }
    $where = "{$searchField} {$ops} '{$searchString}'";
    $objects = Store::get_by_sql("SELECT * FROM " . T_STORES . " WHERE " . $where . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
} else {
    $objects = Store::get_by_sql("SELECT * FROM " . T_STORES . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
}
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($objects as $object) {
    $s .= "<row id='" . $object->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $object->id . "</cell>";
    $s .= "<cell>" . $object->picture . "</cell>";
    $s .= "<cell>" . $object->name . "</cell>";
    $s .= "<cell>" . $object->branchname . "</cell>";
    $s .= "<cell>" . $object->address . "</cell>";
开发者ID:NemOry,项目名称:DroidStoreWebPanel,代码行数:31,代码来源:stores_xml.php


注:本文中的Store::get_by_sql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。