本文整理汇总了PHP中XDB::result_first方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::result_first方法的具体用法?PHP XDB::result_first怎么用?PHP XDB::result_first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDB
的用法示例。
在下文中一共展示了XDB::result_first方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count_by_wherec
public function count_by_wherec($condition)
{
if (is_array($condition)) {
$where = " AND " . implode($condition, ' AND ');
}
return XDB::result_first("SELECT COUNT(*) FROM %t WHERE 1 %i", array($this->_table, $where));
}
示例2: count_by_fid
public function count_by_fid($fids)
{
if (empty($fids)) {
return 0;
}
return XDB::result_first('SELECT COUNT(*) FROM %t WHERE ' . XDB::field('fid', $fids), array($this->_table));
}
示例3: fetch_groupnum_by_founderuid
public function fetch_groupnum_by_founderuid($uid)
{
if (empty($uid)) {
return false;
}
return XDB::result_first("SELECT COUNT(*) FROM " . XDB::table($this->_table) . " WHERE founderuid=%d", array($uid));
}
示例4: fetch_all_username_by_uid
public function fetch_all_username_by_uid($uid)
{
$user = '';
if ($uid) {
$user = XDB::result_first('SELECT username FROM %t WHERE uid=%s', array($this->_table, $uid));
}
return $user;
}
示例5: fetch_count
public function fetch_count()
{
return XDB::result_first("SELECT count(*) FROM " . XDB::table('forum_grouplevel'));
}
示例6: check_variable
public function check_variable($pluginid, $variable)
{
return XDB::result_first("SELECT COUNT(*) FROM %t WHERE pluginid=%d AND variable=%s", array($this->_table, $pluginid, $variable));
}
示例7: result_level_by_id
public function result_level_by_id($id)
{
return XDB::result_first("SELECT level FROM %t WHERE id=%d", array($this->_table, $id));
}
示例8: fetch_groupname_by_order
public function fetch_groupname_by_order($order)
{
return XDB::result_first("SELECT groupname FROM %t WHERE `order` = %d ", array($this->_table, $order));
}
示例9: fetch_all_for_grouplist
public function fetch_all_for_grouplist($orderby = 'displayorder', $fieldarray = array(), $num = 1, $fids = array(), $sort = 0, $getcount = 0)
{
if ($fieldarray && is_array($fieldarray)) {
$fieldadd = '';
foreach ($fieldarray as $field) {
$fieldadd .= $field . ', ';
}
} else {
$fieldadd = 'ff.*, ';
}
$start = 0;
if (is_array($num)) {
list($start, $snum) = $num;
} else {
$snum = $num;
}
$orderbyarray = array('displayorder' => 'f.displayorder DESC', 'dateline' => 'ff.dateline DESC', 'lastupdate' => 'ff.lastupdate DESC', 'membernum' => 'ff.membernum DESC', 'thread' => 'f.threads DESC', 'activity' => 'f.commoncredits DESC');
$useindex = $orderby == 'displayorder' ? 'USE INDEX(fup_type)' : '';
$orderby = !empty($orderby) && $orderbyarray[$orderby] ? "ORDER BY " . $orderbyarray[$orderby] : '';
$limitsql = $num ? "LIMIT {$start}, {$snum} " : '';
$field = $sort ? 'fup' : 'fid';
$fids = $fids && is_array($fids) ? 'f.' . $field . ' IN (' . dimplode($fids) . ')' : '';
if (empty($fids)) {
$levelsql = " AND f.level>'-1'";
}
$fieldsql = $fieldadd . ' f.fid, f.name, f.threads, f.posts, f.todayposts, f.level as flevel ';
if ($getcount) {
return XDB::result_first("SELECT count(*) FROM " . XDB::table($this->_table) . " f {$useindex} WHERE" . ($fids ? " {$fids} AND " : '') . " f.type='sub' AND f.status=3 {$levelsql}");
}
return XDB::fetch_all("SELECT {$fieldsql} FROM " . XDB::table($this->_table) . " f {$useindex} LEFT JOIN " . XDB::table("forum_forumfield") . " ff ON ff.fid=f.fid WHERE" . ($fids ? " {$fids} AND " : '') . " f.type='sub' AND f.status=3 {$levelsql} {$orderby} {$limitsql}");
}
示例10: 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;
}
示例11: fetch_by_modename
public function fetch_by_modename($modename, $bid)
{
return XDB::result_first("SELECT %i FROM %t WHERE bid='%i'", array($modename, $this->_table, $bid));
}
示例12: count_by_id_idtype
public function count_by_id_idtype($id, $idtype)
{
return XDB::result_first("SELECT COUNT(*) FROM %t WHERE id=%d AND idtype=%s", array($this->_table, $id, $idtype));
}
示例13: getid_by_keyword
public function getid_by_keyword($keyword)
{
return XDB::result_first("SELECT id FROM %t WHERE keyword=%s", array($this->_table, $keyword));
}
示例14: fetch_max_tid
public function fetch_max_tid()
{
return XDB::result_first("SELECT MAX(tid) as maxtid FROM " . XDB::table('forum_thread'));
}
示例15: count_by_tid_post
public function count_by_tid_post($tableid, $tid)
{
return XDB::result_first('SELECT COUNT(*) FROM %t WHERE tid=%d AND invisible=0 AND first=0', array(self::get_tablename($tableid), $tid));
}