本文整理汇总了PHP中XDB::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::fetch方法的具体用法?PHP XDB::fetch怎么用?PHP XDB::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDB
的用法示例。
在下文中一共展示了XDB::fetch方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear
public function clear()
{
require_once libfile('function/forum');
$delaids = array();
$query = XDB::query("SELECT aid, attachment, thumb FROM %t WHERE %i", array($this->_table, XDB::field('dateline', TIMESTAMP - 86400)));
while ($attach = XDB::fetch($query)) {
dunlink($attach);
$delaids[] = $attach['aid'];
}
if ($delaids) {
XDB::query("DELETE FROM %t WHERE %i", array('forum_attachment', XDB::field('aid', $delaids)), false, true);
XDB::query("DELETE FROM %t WHERE %i", array($this->_table, XDB::field('dateline', TIMESTAMP - 86400)), false, true);
}
}
示例2: fetch_by_aid_uid
public function fetch_by_aid_uid($aid, $uid)
{
$query = XDB::query("SELECT * FROM %t WHERE aid=%d AND uid=%d", array($this->_table, $aid, $uid));
return XDB::fetch($query);
}
示例3: fetch_table_struct
function fetch_table_struct($tablename, $result = 'FIELD')
{
if (empty($tablename)) {
return array();
}
$datas = array();
$query = XDB::query("DESCRIBE " . XDB::table($tablename));
while ($data = XDB::fetch($query)) {
$datas[$data['Field']] = $result == 'FIELD' ? $data['Field'] : $data;
}
return $datas;
}
示例4: groupuserlist
public function groupuserlist($fid, $orderby = '', $num = 0, $start = 0, $addwhere = '', $fieldarray = array(), $onlinemember = array())
{
$fid = intval($fid);
if ($fieldarray && is_array($fieldarray)) {
$fieldadd = 'uid';
foreach ($fieldarray as $field) {
$fieldadd .= ' ,' . $field;
}
} else {
$fieldadd = '*';
}
$sqladd = $levelwhere = '';
if ($addwhere) {
if (is_array($addwhere)) {
foreach ($addwhere as $field => $value) {
if (is_array($value)) {
$levelwhere = "AND level>'0' ";
$sqladd .= "AND {$field} IN (" . dimplode($value) . ") ";
} else {
$sqladd .= is_numeric($field) ? "AND {$value} " : "AND {$field}='{$value}' ";
}
}
if (!empty($addwhere['level'])) {
$levelwhere = '';
}
} else {
$sqladd = $addwhere;
}
}
$orderbyarray = array('level_join' => 'level ASC, joindateline ASC', 'joindateline' => 'joindateline DESC', 'lastupdate' => 'lastupdate DESC', 'threads' => 'threads DESC', 'replies' => 'replies DESC');
$orderby = !empty($orderbyarray[$orderby]) ? "ORDER BY {$orderbyarray[$orderby]}" : '';
$limitsql = $num ? XDB::limit($start, $num) : '';
$groupuserlist = array();
$query = XDB::query("SELECT {$fieldadd} FROM " . XDB::table('forum_groupuser') . " WHERE fid=%d {$levelwhere} %i {$orderby} {$limitsql}", array($fid, $sqladd));
while ($groupuser = XDB::fetch($query)) {
$groupuserlist[$groupuser['uid']] = $groupuser;
$groupuserlist[$groupuser['uid']]['online'] = !empty($onlinemember) && is_array($onlinemember) && !empty($onlinemember[$groupuser['uid']]) ? 1 : 0;
}
return $groupuserlist;
}
示例5: fetch_all_field
public function fetch_all_field()
{
$data = false;
$query = XDB::query('SHOW FIELDS FROM ' . XDB::table($this->_table), '', 'SILENT');
if ($query) {
$data = array();
while ($value = XDB::fetch($query)) {
$data[$value['Field']] = $value;
}
}
return $data;
}
示例6: fetch_all_rank_thread
public function fetch_all_rank_thread($dateline, $notfid, $order = 'dateline', $start = 0, $limit = 0)
{
$parameter = array($this->get_table_name());
$data = $fids = $wherearr = array();
if ($dateline) {
$parameter[] = $dateline;
$wherearr[] = 'dateline>%d';
}
$wherearr[] = 'displayorder>=0';
if ($notfid) {
$parameter[] = $notfid;
$wherearr[] = 'fid NOT IN(%n)';
}
$wheresql = ' WHERE ' . implode(' AND ', $wherearr);
$ordersql = !empty($order) ? ' ORDER BY ' . XDB::order($order, 'DESC') : '';
$query = XDB::query("SELECT tid, fid, author, authorid, subject, dateline, views, replies, favtimes, sharetimes, heats FROM %t {$wheresql} {$ordersql} " . XDB::limit($start, $limit), $parameter);
while ($value = XDB::fetch($query)) {
$data[$value['tid']] = $value;
$fids[$value['fid']][$value['tid']] = $value['tid'];
}
if (!empty($fids)) {
foreach (C::t('forum_forum')->fetch_all_name_by_fid(array_keys($fids)) as $value) {
foreach ($fids[$value['fid']] as $tid) {
$data[$tid]['forum'] = $value['name'];
}
}
}
return $data;
}
示例7: show_table_columns
public function show_table_columns($table)
{
$data = array();
$db =& XDB::object();
if ($db->version() > '4.1') {
$query = $db->query("SHOW FULL COLUMNS FROM " . XDB::table($table), 'SILENT');
} else {
$query = $db->query("SHOW COLUMNS FROM " . XDB::table($table), 'SILENT');
}
while ($field = @XDB::fetch($query)) {
$data[$field['Field']] = $field;
}
return $data;
}