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


PHP XDB::order方法代码示例

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


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

示例1: fetch_all_by_upid

 public function fetch_all_by_upid($upid, $order = null, $sort = 'DESC')
 {
     $upid = is_array($upid) ? array_map('intval', (array) $upid) : dintval($upid);
     if ($upid !== null) {
         $ordersql = $order !== null && !empty($order) ? ' ORDER BY ' . XDB::order($order, $sort) : '';
         return XDB::fetch_all('SELECT * FROM %t WHERE ' . XDB::field('upid', $upid) . " {$ordersql}", array($this->_table), $this->_pk);
     }
     return array();
 }
开发者ID:herosrx,项目名称:shops,代码行数:9,代码来源:table_common_district.php

示例2: fetch_all_by_id

 public function fetch_all_by_id($idtype, $ids, $orderby = '')
 {
     $attachments = array();
     if ($orderby) {
         $orderby = 'ORDER BY ' . XDB::order($orderby, 'DESC');
     }
     if (in_array($idtype, array('aid', 'tid', 'pid', 'uid')) && $ids) {
         $query = XDB::query("SELECT * FROM %t WHERE %i IN (%n) %i", array($this->_table, $idtype, (array) $ids, $orderby));
         while ($value = XDB::fetch($query)) {
             $attachments[$value['aid']] = $value;
             $this->_tableids[$value['tableid']][] = $value['aid'];
         }
     }
     return $attachments;
 }
开发者ID:herosrx,项目名称:shops,代码行数:15,代码来源:table_forum_attachment.php

示例3: range

 public function range($start = 0, $limit = 0, $sort = '')
 {
     if ($sort) {
         $this->checkpk();
     }
     return XDB::fetch_all('SELECT * FROM ' . XDB::table($this->_table) . ($sort ? ' ORDER BY ' . XDB::order($this->_pk, $sort) : '') . XDB::limit($start, $limit), null, $this->_pk ? $this->_pk : '');
 }
开发者ID:herosrx,项目名称:shops,代码行数:7,代码来源:discuz_table.php

示例4: fetch_all_by_search

 public function fetch_all_by_search($fetchtype, $uids, $albumname, $searchname, $catid, $starttime, $endtime, $albumids, $friend = '', $orderfield = '', $ordersort = 'DESC', $start = 0, $limit = 0, $findex = '')
 {
     $parameter = array($this->_table);
     $wherearr = array();
     if (is_array($uids) && count($uids)) {
         $parameter[] = $uids;
         $wherearr[] = 'uid IN(%n)';
     }
     if ($albumname) {
         if ($searchname == false) {
             $parameter[] = $albumname;
             $wherearr[] = 'albumname=%s';
         } else {
             $parameter[] = '%' . $albumname . '%';
             $wherearr[] = 'albumname LIKE %s';
         }
     }
     if ($catid) {
         $parameter[] = $catid;
         $wherearr[] = 'catid=%d';
     }
     if ($starttime) {
         $parameter[] = is_numeric($starttime) ? $starttime : strtotime($starttime);
         $wherearr[] = 'dateline>%d';
     }
     if ($endtime) {
         $parameter[] = is_numeric($endtime) ? $endtime : strtotime($endtime);
         $wherearr[] = 'dateline<%d';
     }
     if (is_numeric($friend)) {
         $parameter[] = $friend;
         $wherearr[] = 'friend=%d';
     }
     if (is_array($albumids) && count($albumids)) {
         $parameter[] = $albumids;
         $wherearr[] = 'albumid IN(%n)';
     }
     if ($fetchtype == 3) {
         $selectfield = "count(*)";
     } elseif ($fetchtype == 2) {
         $selectfield = "albumid";
     } else {
         $selectfield = "*";
         if (is_string($orderfield) && ($order = XDB::order($orderfield, $ordersort))) {
             $ordersql = 'ORDER BY ' . $order;
         }
         if ($limit) {
             $parameter[] = XDB::limit($start, $limit);
             $ordersql .= ' %i';
         }
     }
     if ($findex) {
         $findex = 'USE INDEX(updatetime)';
     }
     $wheresql = !empty($wherearr) && is_array($wherearr) ? ' WHERE ' . implode(' AND ', $wherearr) : '';
     if ($fetchtype == 3) {
         return XDB::result_first("SELECT {$selectfield} FROM %t {$wheresql}", $parameter);
     } else {
         return XDB::fetch_all("SELECT {$selectfield} FROM %t {$findex} {$wheresql} {$ordersql}", $parameter);
     }
 }
开发者ID:herosrx,项目名称:shops,代码行数:61,代码来源:table_sanree_brand_album.php

示例5: fetch_all_by_special

 public function fetch_all_by_special($special, $authorid = 0, $replies = 0, $displayorder = null, $subject = '', $join = 0, $start = 0, $limit = 0, $order = 'dateline', $sort = 'DESC')
 {
     $condition = $this->make_special_condition($special, $authorid, $replies, $displayorder, $subject, $join, 0);
     $ordersql = !empty($order) ? ' ORDER BY t.' . XDB::order($order, $sort) : '';
     return XDB::fetch_all("SELECT t.* FROM %t t {$condition['jointable']} " . $condition['where'] . $ordersql . XDB::limit($start, $limit), $condition['parameter'], $this->_pk);
 }
开发者ID:herosrx,项目名称:shops,代码行数:6,代码来源:table_forum_thread.php

示例6: fetch_all_new_post_by_pid

 public function fetch_all_new_post_by_pid($pid, $start = 0, $limit = 0, $tableid = 0, $glue = '>', $sort = 'ASC')
 {
     return $limit ? XDB::fetch_all('SELECT * FROM ' . XDB::table($this->get_tablename($tableid)) . ' WHERE ' . XDB::field('pid', $pid, $glue) . ' ORDER BY ' . XDB::order('pid', $sort) . XDB::limit($start, $limit), $this->_pk) : array();
 }
开发者ID:herosrx,项目名称:shops,代码行数:4,代码来源:table_forum_post.php


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