本文整理汇总了PHP中XDB::fetch_first方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::fetch_first方法的具体用法?PHP XDB::fetch_first怎么用?PHP XDB::fetch_first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDB
的用法示例。
在下文中一共展示了XDB::fetch_first方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch_by_id_idtype
public function fetch_by_id_idtype($id, $idtype, $uid = 0)
{
if ($uid) {
$uidsql = ' AND ' . XDB::field('uid', $uid);
}
return XDB::fetch_first("SELECT * FROM %t WHERE id=%d AND idtype=%s {$uidsql}", array($this->_table, $id, $idtype));
}
示例2: fetch_userinfo
public function fetch_userinfo($uid, $fid)
{
if (empty($uid) || empty($fid)) {
return array();
}
return XDB::fetch_first("SELECT * FROM %t WHERE fid=%d AND uid=%d", array($this->_table, $fid, $uid));
}
示例3: fetch_by_username
public function fetch_by_username($username)
{
$user = array();
if ($username) {
$user = XDB::fetch_first('SELECT * FROM %t WHERE username=%s', array($this->_table, $username));
}
return $user;
}
示例4: 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));
}
示例5: fetch
public function fetch($id, $force_from_db = false)
{
$data = array();
if (!empty($id)) {
if ($force_from_db || ($data = $this->fetch_cache($id)) === false) {
$data = XDB::fetch_first('SELECT * FROM ' . XDB::table($this->_table) . ' WHERE ' . XDB::field($this->_pk, $id));
if (!empty($data)) {
$this->store_cache($id, $data);
}
}
}
return $data;
}
示例6: fetch_by_bid
public function fetch_by_bid($bid)
{
return XDB::fetch_first("SELECT * FROM %t WHERE bid='%i'", array($this->_table, $bid));
}
示例7: get_by_cateidanduid
public function get_by_cateidanduid($uid, $cateid)
{
return XDB::fetch_first("SELECT * FROM %t where uid=%d,cateid=%d", array($this->_table, $uid, $cateid));
}
示例8: get_by_id
public function get_by_id($helpid)
{
return XDB::fetch_first("SELECT * FROM %t WHERE flid=%d", array($this->_table, $helpid));
}
示例9: get_by_diystyleid
public function get_by_diystyleid($diystyleid)
{
return XDB::fetch_first("SELECT * FROM %t WHERE diystyleid=%d", array($this->_table, $diystyleid));
}
示例10: fetch_by_credits
public function fetch_by_credits($credits = 0)
{
return XDB::fetch_first("SELECT * FROM %t WHERE creditshigher<=%d AND %d<creditslower LIMIT 1", array($this->_table, $credits, $credits));
}
示例11: show_table_by_tableid
public function show_table_by_tableid($tableid)
{
return XDB::fetch_first('SHOW CREATE TABLE %t', array(self::get_tablename($tableid)));
}
示例12: fetch_max_image
public function fetch_max_image($tableid, $idtype, $id)
{
return $this->_check_id($idtype, $id) ? XDB::fetch_first('SELECT * FROM %t WHERE %i AND isimage IN (1, -1) ORDER BY width DESC LIMIT 1', array($this->_get_table($tableid), XDB::field($idtype, $id))) : array();
}
示例13: fetch_mfandtag_by_groupid
public function fetch_mfandtag_by_groupid($groupid)
{
return XDB::fetch_first("SELECT ismf,istag FROM %t WHERE groupid=%d", array($this->_table, $groupid));
}
示例14: fetch_all
public function fetch_all()
{
return XDB::fetch_first("SELECT * FROM %t ", array($this->_table));
}
示例15: 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;
}