當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。