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


PHP XDB::table方法代码示例

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


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

示例1: update_all

 public function update_all($data)
 {
     if (is_array($data)) {
         $update = array();
         foreach ($data as $key => $val) {
             $update[] = "`" . $key . "` = '" . $val . "'";
         }
         $setwhere = implode($update, ', ');
         XDB::query("UPDATE " . XDB::table($this->_table) . " SET " . $setwhere);
     }
 }
开发者ID:herosrx,项目名称:shops,代码行数:11,代码来源:table_sanree_brand_businesses_module.php

示例2: check_moderator_for_uid

 public function check_moderator_for_uid($fid, $uid, $accessmasks = 0)
 {
     if (!intval($fid) || !intval($uid)) {
         return false;
     }
     if ($accessmasks) {
         $accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach, a.allowgetimage, a.allowpostattach';
         $accessadd2 = "LEFT JOIN " . XDB::table('forum_access') . " a ON a." . XDB::field('uid', $uid) . " AND a." . XDB::field('fid', $fid);
     }
     return XDB::fetch_first("SELECT ff.postperm, m.uid AS istargetmod {$accessadd1}\n\t\t\t\tFROM " . XDB::table($this->_table) . " ff\n\t\t\t\t{$accessadd2}\n\t\t\t\tLEFT JOIN " . XDB::table('forum_moderator') . " m ON m.fid=%d AND m.uid=%d\n\t\t\t\tWHERE ff.fid=%d", array($fid, $uid, $fid));
 }
开发者ID:herosrx,项目名称:shops,代码行数:11,代码来源:table_forum_forumfield.php

示例3: updatestar_by_bid

 public function updatestar_by_bid($uid, $username, $bid, $star = 1)
 {
     !in_array($star, array(1, 2, 3, 4, 5)) && ($star = 1);
     $hcount = C::t('#sanree_brand#sanree_brand_voterlog')->getvoter_by_bid_uid($uid, $bid);
     if ($hcount > 0) {
         return 0;
     }
     $data = array('uid' => $uid, 'username' => $username, 'bid' => $bid, 'star' => $star, 'dateline' => TIMESTAMP);
     C::t('#sanree_brand#sanree_brand_voterlog')->insert($data);
     $tcount = $this->getvoter_by_bid($bid);
     if ($tcount > 0) {
         XDB::query("UPDATE " . XDB::table($this->_table) . " SET `star" . $star . "`= star" . $star . " + 1 WHERE `bid`=" . $bid);
     } else {
         $mdata = array('uid' => $uid, 'bid' => $bid, 'star' . $star => 1, 'dateline' => TIMESTAMP);
         $this->insert($mdata);
     }
     return 1;
 }
开发者ID:herosrx,项目名称:shops,代码行数:18,代码来源:table_sanree_brand_voter.php

示例4: 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

示例5: get_forum_by_fid

 function get_forum_by_fid($fid, $field = '', $table = 'forum')
 {
     static $forumlist = array('forum' => array(), 'forumfield' => array());
     $table = $table != 'forum' ? 'forumfield' : 'forum';
     $return = array();
     if (!array_key_exists($fid, $forumlist[$table])) {
         $forumlist[$table][$fid] = XDB::fetch_first("SELECT * FROM " . XDB::table('forum_' . $table) . " WHERE fid=%d", array($fid));
         if (!is_array($forumlist[$table][$fid])) {
             $forumlist[$table][$fid] = array();
         }
     }
     if (!empty($field)) {
         $return = isset($forumlist[$table][$fid][$field]) ? $forumlist[$table][$fid][$field] : null;
     } else {
         $return = $forumlist[$table][$fid];
     }
     return $return;
 }
开发者ID:herosrx,项目名称:shops,代码行数:18,代码来源:table_forum_forum.php

示例6: addfield

 public function addfield($addsql)
 {
     runquery("ALTER TABLE " . XDB::table($this->_table) . " ADD " . $addsql);
 }
开发者ID:herosrx,项目名称:shops,代码行数:4,代码来源:table_sanree_brand_group_module.php

示例7: fetch_count

 public function fetch_count()
 {
     return XDB::result_first("SELECT count(*) FROM " . XDB::table('forum_grouplevel'));
 }
开发者ID:herosrx,项目名称:shops,代码行数:4,代码来源:table_forum_grouplevel.php

示例8: cleartable

 public function cleartable()
 {
     runquery("TRUNCATE TABLE `" . XDB::table($this->_table) . "`;");
 }
开发者ID:herosrx,项目名称:shops,代码行数:4,代码来源:table_sanree_brand_district.php

示例9: fetch_all_group_for_user

 public function fetch_all_group_for_user($uid, $count = 0, $ismanager = 0, $start = 0, $num = 0)
 {
     $uid = intval($uid);
     if (empty($uid)) {
         return array();
     }
     if (empty($ismanager)) {
         $levelsql = '';
     } elseif ($ismanager == 1) {
         $levelsql = ' AND level IN(1,2)';
     } elseif ($ismanager == 2) {
         $levelsql = ' AND level IN(3,4)';
     }
     if ($count == 1) {
         return XDB::result_first("SELECT count(*) FROM " . XDB::table('forum_groupuser') . " WHERE uid='{$uid}' {$levelsql}");
     }
     empty($start) && ($start = 0);
     empty($num) && ($num = 100);
     return XDB::fetch_all("SELECT fid, level FROM " . XDB::table('forum_groupuser') . " WHERE uid='{$uid}' {$levelsql} ORDER BY lastupdate DESC " . XDB::limit($start, $num));
 }
开发者ID:herosrx,项目名称:shops,代码行数:20,代码来源:table_forum_groupuser.php

示例10: optimize

 public function optimize()
 {
     XDB::query('OPTIMIZE TABLE ' . XDB::table($this->_table), 'SILENT');
 }
开发者ID:herosrx,项目名称:shops,代码行数:4,代码来源:discuz_table.php

示例11: fetch_all_by_block

 public function fetch_all_by_block($aids, $bannedids, $uids, $catid, $startrow, $items, $orderby)
 {
     $wheres = array();
     if ($aids) {
         $wheres[] = XDB::field('albumid', $aids, 'in');
     }
     if ($bannedids) {
         $wheres[] = XDB::field('albumid', $bannedids, 'notin');
     }
     if ($uids) {
         $wheres[] = XDB::field('uid', $uids, 'in');
     }
     if ($catid && !in_array('0', $catid)) {
         $wheres[] = XDB::field('catid', $catid, 'in');
     }
     $wheres[] = "friend = '0'";
     $wheresql = $wheres ? implode(' AND ', $wheres) : '1';
     if (!in_array($orderby, array('dateline', 'picnum', 'updatetime'))) {
         $orderby = 'dateline';
     }
     return XDB::fetch_all('SELECT * FROM ' . XDB::table($this->_table) . ' WHERE ' . $wheresql . ' ORDER BY ' . XDB::order($orderby, 'DESC') . XDB::limit($startrow, $items));
 }
开发者ID:herosrx,项目名称:shops,代码行数:22,代码来源:table_sanree_brand_album.php

示例12: create_table

 public function create_table($maxtableid)
 {
     if ($maxtableid) {
         XDB::query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT');
         $db =& XDB::object();
         $query = XDB::query("SHOW CREATE TABLE %t", array($this->get_table_name()));
         $create = $db->fetch_row($query);
         $createsql = $create[1];
         $createsql = str_replace(XDB::table($this->get_table_name()), XDB::table($this->get_table_name($maxtableid)), $createsql);
         XDB::query($createsql);
         return true;
     } else {
         return false;
     }
 }
开发者ID:herosrx,项目名称:shops,代码行数:15,代码来源:table_forum_thread.php

示例13: getposttable

 public static function getposttable($tableid = 0, $prefix = false)
 {
     global $_G;
     $tableid = intval($tableid);
     if ($tableid) {
         loadcache('posttableids');
         $tableid = $_G['cache']['posttableids'] && in_array($tableid, $_G['cache']['posttableids']) ? $tableid : 0;
         $tablename = 'forum_post' . ($tableid ? "_{$tableid}" : '');
     } else {
         $tablename = 'forum_post';
     }
     if ($prefix) {
         $tablename = XDB::table($tablename);
     }
     return $tablename;
 }
开发者ID:herosrx,项目名称:shops,代码行数:16,代码来源:table_forum_post.php

示例14: get_total_filesize

 public function get_total_filesize()
 {
     $attachsize = 0;
     for ($i = 0; $i < 10; $i++) {
         $attachsize += XDB::result_first("SELECT SUM(filesize) FROM " . XDB::table('forum_attachment_' . $i));
     }
     return $attachsize;
 }
开发者ID:herosrx,项目名称:shops,代码行数:8,代码来源:table_forum_attachment_n.php


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