當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XDB::quote方法代碼示例

本文整理匯總了PHP中XDB::quote方法的典型用法代碼示例。如果您正苦於以下問題:PHP XDB::quote方法的具體用法?PHP XDB::quote怎麽用?PHP XDB::quote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XDB的用法示例。


在下文中一共展示了XDB::quote方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fetch_all_for_manage

 public function fetch_all_for_manage($tableid, $inforum = '', $authorid = 0, $filename = '', $keyword = '', $sizeless = 0, $sizemore = 0, $dlcountless = 0, $dlcountmore = 0, $daysold = 0, $count = 0, $start = 0, $limit = 0)
 {
     $sql = "1";
     if (!is_numeric($tableid) || $tableid < 0 || $tableid > 9) {
         return;
     }
     if ($inforum) {
         $sql .= is_numeric($inforum) ? " AND t.fid=" . XDB::quote($inforum) : '';
         $sql .= $inforum == 'isgroup' ? ' AND t.isgroup=\'1\'' : ' AND t.isgroup=\'0\'';
     }
     if ($authorid) {
         $sql .= " AND a.uid=" . XDB::quote($authorid);
     }
     if ($filename) {
         $sql .= " AND a.filename LIKE " . XDB::quote('%' . $filename . '%');
     }
     if ($keyword) {
         $sqlkeywords = $or = '';
         foreach (explode(',', str_replace(' ', '', $keyword)) as $keyword) {
             $sqlkeywords .= " {$or} a.description LIKE " . XDB::quote('%' . $keyword . '%');
             $or = 'OR';
         }
         $sql .= " AND ({$sqlkeywords})";
     }
     $sql .= $sizeless ? " AND a.filesize>'{$sizeless}'" : '';
     $sql .= $sizemore ? " AND a.filesize<'{$sizemore}' " : '';
     $sql .= $dlcountless ? " AND ai.downloads<'{$dlcountless}'" : '';
     $sql .= $dlcountmore ? " AND ai.downloads>'{$dlcountmore}'" : '';
     $sql .= $daysold ? " AND a.dateline<'" . (TIMESTAMP - intval($daysold) * 86400) . "'" : '';
     if ($count) {
         return XDB::result_first("SELECT COUNT(*)\n\t\t\t\tFROM " . XDB::table('forum_attachment_' . $tableid) . " a\n\t\t\t\tINNER JOIN " . XDB::table('forum_attachment') . " ai USING(aid)\n\t\t\t\tINNER JOIN " . XDB::table('forum_thread') . " t\n\t\t\t\tINNER JOIN " . XDB::table('forum_forum') . " f\n\t\t\t\tWHERE t.tid=a.tid AND f.fid=t.fid AND t.displayorder>='0' AND {$sql}");
     }
     return XDB::fetch_all("SELECT a.*, ai.downloads, t.fid, t.tid, t.subject, f.name AS fname\n\t\t\t\tFROM " . XDB::table('forum_attachment_' . $tableid) . " a\n\t\t\t\tINNER JOIN " . XDB::table('forum_attachment') . " ai USING(aid)\n\t\t\t\tINNER JOIN " . XDB::table('forum_thread') . " t\n\t\t\t\tINNER JOIN " . XDB::table('forum_forum') . " f\n\t\t\t\tWHERE t.tid=a.tid AND f.fid=t.fid AND t.displayorder>='0' AND {$sql} ORDER BY a.aid DESC " . XDB::limit($start, $limit));
 }
開發者ID:herosrx,項目名稱:shops,代碼行數:34,代碼來源:table_forum_attachment.php


注:本文中的XDB::quote方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。