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


PHP DB::fetch_first方法代码示例

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


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

示例1: post

 function post()
 {
     global $_G;
     if ($_GET['onsubmit'] && check()) {
         $arr = array();
         $arr['title'] = trim_html($_GET['title'], 1);
         $arr['fid'] = intval($_GET['fid']);
         $value = $_GET['postdb'];
         $arr['value'] = serialize($value);
         $url = '';
         if ($_GET['id']) {
             $id = intval($_GET['id']);
             DB::update(__CLASS__, $arr, "id=" . $id);
             $url = '&id=' . $id;
             $msg = '修改';
         } else {
             $msg = '添加';
             $arr['dateline'] = TIMESTAMP;
             $arr['count'] = 0;
             $arr['updatetime'] = 0;
             $arr['count'] = 0;
             DB::insert(__CLASS__, $arr, true);
         }
         cpmsg($msg . '成功', 'success', 'm=' . __CLASS__ . '&a=' . __FUNCTION__ . $url);
     } elseif ($_GET['id']) {
         $id = intval($_GET['id']);
         $rs = DB::fetch_first("SELECT * FROM " . DB::table('fetch') . " WHERE id = " . $id);
         $fetch = dunserialize($rs['value']);
         $fetch = array_merge($fetch, $rs);
         //dump($fetch);
     }
     $cates = (include libfile('config/taobao_cate'));
     $this->add(array('cates' => $cates, 'fetch' => $fetch));
     $this->show();
 }
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:35,代码来源:fetch.action.php

示例2: run

 function run($cronid = 0)
 {
     global $_G;
     $timestamp = TIMESTAMP;
     $cron = DB::fetch_first("SELECT * FROM " . DB::table('common_cron') . "\n\t\t\t\tWHERE " . ($cronid ? "cronid='{$cronid}'" : "available>'0' AND nextrun<='{$timestamp}'") . "\n\t\t\t\tORDER BY nextrun LIMIT 1");
     $processname = 'DZ_CRON_' . (empty($cron) ? 'CHECKER' : $cron['cronid']);
     if ($cronid && !empty($cron)) {
         discuz_process::unlock($processname);
     }
     if (discuz_process::islocked($processname, 600)) {
         return false;
     }
     if ($cron) {
         $cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']);
         $cronfile = DISCUZ_ROOT . './source/include/cron/' . $cron['filename'];
         $cron['minute'] = explode("\t", $cron['minute']);
         discuz_cron::setnextime($cron);
         @set_time_limit(1000);
         @ignore_user_abort(TRUE);
         if (!@(include $cronfile)) {
             return false;
         }
     }
     discuz_cron::nextcron();
     discuz_process::unlock($processname);
     return true;
 }
开发者ID:pan289091315,项目名称:Discuz,代码行数:27,代码来源:class_cron.php

示例3: delete

 function delete($value, $key = "id")
 {
     global $_G;
     if (!$value) {
         return array('status' => 'error', 'msg' => '要删除的图片值不能为空');
     }
     $value = addslashes($value);
     $key = addslashes($key);
     $rs = DB::fetch_first("SELECT * FROM " . DB::table('images') . " WHERE {$key} = '{$value}'");
     if (!$rs['id']) {
         return array('status' => 'error', 'msg' => '图片不存在,或不是通过后台上传的,如果图片连接失效,您可手动清空图片内容', 'a' => 'readonly');
     }
     if ($rs['location'] == 1) {
         if ($_G[adminid] != 1 && $_G[uid] != $rs[uid]) {
             return array('status' => 'error', 'msg' => '您无法删除非自己上传的图片', 'a' => 'readonly');
         }
         DB::delete('images', "id=" . $rs[id]);
         @unlink(ROOT_PATH . $rs[img_url]);
         return array('status' => 'success', 'msg' => '删除成功,请提交表单保存', 'a' => 'del');
     }
     $response = $imgService->deleteUZImgById($rs['img_id']);
     if ($response->isSuccess()) {
         DB::delete('images', "id=" . $rs[id]);
         return array('status' => 'success', 'msg' => '删除成功,请提交表单保存', 'a' => 'del');
     } else {
         return array('status' => 'error', 'msg' => '图片删除失败' . $response->getErrorMsg());
     }
 }
开发者ID:lqlstudio,项目名称:ttae_open,代码行数:28,代码来源:image.class.php

示例4: fetch_by_aid_page

 public function fetch_by_aid_page($aid, $page = 1)
 {
     if (($page = dintval($page)) < 1) {
         $page = 1;
     }
     return $aid ? DB::fetch_first('SELECT * FROM %t WHERE aid=%d ORDER BY pageorder' . DB::LIMIT($page - 1, 1), array($this->_table, $aid)) : false;
 }
开发者ID:dalinhuang,项目名称:healthshop,代码行数:7,代码来源:table_portal_article_content.php

示例5: fetch_userinfo

 public function fetch_userinfo($uid, $fid)
 {
     if (empty($uid) || empty($fid)) {
         return array();
     }
     return DB::fetch_first("SELECT * FROM %t WHERE fid=%d AND uid=%d", array($this->_table, $fid, $uid));
 }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:7,代码来源:table_forum_groupuser.php

示例6: fastpick_info

function fastpick_info($id = '', $field = '*', $table = 'fastpick')
{
    global $_G;
    $id = $id ? $id : $_GET['id'];
    $id = intval($id);
    return DB::fetch_first("SELECT {$field} FROM " . DB::table('strayer_' . $table) . " WHERE id='{$id}'");
}
开发者ID:edmundwong,项目名称:V604,代码行数:7,代码来源:function.fastpick.php

示例7: account_bind_info

 function account_bind_info($uid, $key = null, $cache = 1)
 {
     static $S_account_bind_info = null;
     $uid = is_numeric($uid) ? $uid : 0;
     if ($uid < 1) {
         return false;
     }
     if (!$cache || !isset($S_account_bind_info[$uid])) {
         $memberfields = array();
         if ($uid === MEMBER_ID) {
             $memberfields = $GLOBALS['_J']['member'];
         }
         if (!isset($memberfields['account_bind_info'])) {
             $memberfields = DB::fetch_first("SELECT `uid`, `account_bind_info` FROM " . DB::table('memberfields') . " WHERE `uid`='{$uid}' ");
         }
         if ($memberfields['account_bind_info']) {
             $memberfields['account_bind_info'] = unserialize(base64_decode($memberfields['account_bind_info']));
         } else {
             return false;
         }
         $S_account_bind_info[$uid] = $memberfields['account_bind_info'];
     }
     if (is_null($key)) {
         return $S_account_bind_info[$uid];
     } else {
         if (is_null($S_account_bind_info[$uid][$key])) {
             return false;
         } else {
             return $S_account_bind_info[$uid][$key];
         }
     }
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:32,代码来源:misc.class.php

示例8: global_header_mobile

 function global_header_mobile()
 {
     global $_G, $show_message;
     function dsu_signtz()
     {
         dheader('Location: plugin.php?id=dsu_paulsign:sign&mobile=yes');
     }
     $var = $_G['cache']['plugin']['dsu_paulsign'];
     if (defined('IN_dsu_paulsign') || $show_message || defined('IN_dsu_paulsc') || !$_G['uid'] || !$var['ifopen'] || !$var['wap_sign']) {
         return '';
     }
     $tdtime = gmmktime(0, 0, 0, dgmdate($_G['timestamp'], 'n', $var['tos']), dgmdate($_G['timestamp'], 'j', $var['tos']), dgmdate($_G['timestamp'], 'Y', $var['tos'])) - $var['tos'] * 3600;
     $allowmem = memory('check');
     if ($var['ftopen'] && in_array($_G['groupid'], unserialize($var['tzgroupid'])) && !in_array($_G['uid'], explode(",", $var['ban'])) && in_array($_G['groupid'], unserialize($var['groups']))) {
         if ($allowmem && $var['mcacheopen']) {
             $signtime = memory('get', 'dsu_pualsign_' . $_G['uid']);
         }
         if (!$signtime) {
             $qiandaodb = DB::fetch_first("SELECT time FROM " . DB::table('dsu_paulsign') . " WHERE uid='{$_G['uid']}'");
             $signtime = $qiandaodb['time'];
             $htime = dgmdate($_G['timestamp'], 'H', $var['tos']);
             if ($qiandaodb) {
                 if ($allowmem && $var['mcacheopen']) {
                     memory('set', 'dsu_pualsign_' . $_G['uid'], $qiandaodb['time'], 86400);
                 }
                 if ($qiandaodb['time'] < $tdtime) {
                     if ($var['timeopen']) {
                         if (!($htime < $var['stime']) && !($htime > $var['ftime'])) {
                             return dsu_signtz();
                         }
                     } else {
                         return dsu_signtz();
                     }
                 }
             } else {
                 $ttps = DB::fetch_first("SELECT posts FROM " . DB::table('common_member_count') . " WHERE uid='{$_G['uid']}'");
                 if ($var['mintdpost'] <= $ttps['posts']) {
                     if ($var['timeopen']) {
                         if (!($htime < $var['stime']) && !($htime > $var['ftime'])) {
                             return dsu_signtz();
                         }
                     } else {
                         return dsu_signtz();
                     }
                 }
             }
         } else {
             if ($signtime < $tdtime) {
                 if ($var['timeopen']) {
                     if (!($htime < $var['stime']) && !($htime > $var['ftime'])) {
                         return dsu_signtz();
                     }
                 } else {
                     return dsu_signtz();
                 }
             }
         }
     }
     return '<a href="plugin.php?id=dsu_paulsign:sign">' . lang('plugin/dsu_paulsign', 'name') . '</a>';
 }
开发者ID:sayhanabi,项目名称:sayhanabi_forum,代码行数:60,代码来源:sign_mobile.class.php

示例9: insert

 public function insert($tid, $uid)
 {
     if (!DB::fetch_first('SELECT * FROM %t WHERE tid=%d AND uid=%d', array($this->_table, $tid, $uid))) {
         DB::insert($this->_table, array('tid' => $tid, 'uid' => $uid));
         DB::query("UPDATE %t SET hidden=hidden+1 WHERE tid=%d", array('forum_thread', $tid));
     }
 }
开发者ID:lemonstory,项目名称:bbs,代码行数:7,代码来源:table_forum_threadhidelog.php

示例10: updatersscache

function updatersscache($num)
{
    global $_G;
    $processname = 'portal_rss_cache';
    if (discuz_process::islocked($processname, 600)) {
        return false;
    }
    DB::query("DELETE FROM " . DB::table('portal_rsscache') . "");
    require_once libfile('function/post');
    foreach ($_G['cache']['portalcategory'] as $catid => $catarray) {
        $query = DB::query("SELECT aid, username, author, dateline, title, summary\r\n\t\t\tFROM " . DB::table('portal_article_title') . "\r\n\t\t\tWHERE catid='{$catid}' AND status=0\r\n\t\t\tORDER BY aid DESC LIMIT {$num}");
        $catarray['catname'] = addslashes($catarray['catname']);
        while ($article = DB::fetch($query)) {
            $article['author'] = $article['author'] != '' ? addslashes($article['author']) : ($article['username'] ? addslashes($article['username']) : 'Anonymous');
            $article['title'] = addslashes($article['title']);
            $articleattach = DB::fetch_first("SELECT * FROM " . DB::table('portal_attachment') . " WHERE aid='" . $article['aid'] . "' AND isimage=1");
            $attachdata = '';
            if (!empty($articleattach)) {
                $attachdata = "\t" . $articleattach['remote'] . "\t" . $articleattach['attachment'] . "\t" . $articleattach['filesize'];
            }
            $article['description'] = addslashes(messagecutstr($article['summary'], 250 - strlen($attachdata)) . $attachdata);
            DB::query("REPLACE INTO " . DB::table('portal_rsscache') . " (lastupdate, catid, aid, dateline, catname, author, subject, description)\r\n\t\t\t\tVALUES ('{$_G['timestamp']}', '{$catid}', '{$article['aid']}', '{$article['dateline']}', '{$catarray['catname']}', '{$article['author']}', '{$article['title']}', '{$article['description']}')");
        }
    }
    discuz_process::unlock($processname);
    return true;
}
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:27,代码来源:portal_rss.php

示例11: init

 public function init($bz, $isguest = 0)
 {
     global $_G;
     $bzarr = explode(':', $bz);
     $id = trim($bzarr[1]);
     if (!($root = DB::fetch_first("select access_id,bucket,cloudname,bz,access_key,uid from " . DB::table(self::T) . " where id='{$id}'"))) {
         return array('error' => 'need authorize to ' . $bzarr[0]);
     }
     if (!$isguest && $root['uid'] > 0 && $root['uid'] != $_G['uid']) {
         return array('error' => 'need authorize to JSS');
     }
     $access_id = authcode($root['access_id'], 'DECODE', $root['bz']);
     if (empty($access_id)) {
         $access_id = $root['access_id'];
     }
     $access_key = authcode($root['access_key'], 'DECODE', $root['bz']);
     if ($root['cloudname']) {
         $this->_rootname = $root['cloudname'];
     } else {
         $this->_rootname .= ':' . ($root['bucket'] ? $root['bucket'] : cutstr($access_id, 4, $dot = ''));
     }
     $this->bucket = $root['bucket'];
     try {
         return new JingdongStorageService($access_id, $access_key);
     } catch (Exception $e) {
         return array('error' => $e->getMessage());
     }
 }
开发者ID:druphliu,项目名称:dzzoffice,代码行数:28,代码来源:io_JSS.php

示例12: send

 function send()
 {
     $to_user = jfilter($this->Post['to_user'], 'txt');
     $member = DB::fetch_first("SELECT `nickname` FROM " . DB::table("members") . " WHERE `nickname`='{$to_user}'");
     if (empty($member)) {
         Mobile::error("No User", 300);
     }
     $this->Post['message'] = jpost('message', 'txt');
     $to_user = $member['nickname'];
     $data = array('to_user' => $to_user, 'message' => trim($this->Post['message']));
     $ret = $this->MyPmLogic->pmSend($data);
     if ($ret == 0) {
         Mobile::success("Success");
     } else {
         if ($ret == 1) {
             Mobile::error("Content not emtpy", 420);
         } else {
             if ($ret == 2) {
                 Mobile::error("Content not emtpy", 321);
             } else {
                 if (ret == 3) {
                     Mobile::error("Content not emtpy", 321);
                 }
             }
         }
     }
     Mobile::error("Unkonw error", 250);
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:28,代码来源:pm.mod.php

示例13: viewthread_sidetop_output

 function viewthread_sidetop_output($a)
 {
     //var_dump($a);
     global $_G, $postlist;
     if ($a["template"] == "viewthread") {
         $aid = $_G['forum_thread']['authorid'];
         $return = array();
         $tid = $_G['tid'];
         if ($postlist && $aid) {
             foreach ($postlist as $value) {
                 if ($value['first']) {
                     $amu_query = DB::fetch_first("SELECT * FROM " . DB::table("plugin_dsuampper") . " WHERE uid= '{$aid}'");
                     if ($amu_query) {
                         $today = $this->vars['today'];
                         $lasttime = dgmdate($query['lasttime'], 'Ymd', $this->vars['offset']);
                     }
                     if (!$amu_query['addup'] || $today != $lasttime) {
                         $addup = $amu_query['addup'] ? $amu_query['addup'] : 0;
                         $return[0] = '<dl class="pil cl"><dt><a href="plugin.php?id=dsu_amupper:list" target="_blank" class="xi2">' . lang('plugin/dsu_amupper', 'vw') . '</a></dt><dd>' . $addup . '</dd></dl>';
                     }
                     if ($amu_query && $today == $lasttime) {
                         $addup = $amu_query['addup'] ? $amu_query['addup'] : 0;
                         $return[0] = '<dl class="pil cl"><dt><a href="plugin.php?id=dsu_amupper:list" target="_blank" class="xi2">' . lang('plugin/dsu_amupper', 'vw') . '</a></dt><dd><b>' . $addup . '</b></dd></dl>';
                     }
                 }
             }
         }
     } else {
         $return = array();
     }
     return $return;
 }
开发者ID:v998,项目名称:dsu,代码行数:32,代码来源:pper.class.php

示例14: fetch_by_id

 public function fetch_by_id($id)
 {
     $value = self::fetch($id);
     $cloud = DB::fetch_first("select * from " . DB::table('connect') . " where bz='{$value['bz']}'");
     $data = array('id' => $value['id'], 'fid' => md5($cloud['bz'] . ':' . $value['id'] . ':' . $cloud['root']), 'pfid' => 0, 'fname' => $value['cloudname'], 'ficon' => 'dzz/images/default/system/' . $cloud['bz'] . '.png', 'bz' => $cloud['bz'] . ':' . $value['id'] . ':', 'path' => $cloud['bz'] . ':' . $value['id'] . ':' . $cloud['root'], 'type' => 'ftp', 'fsperm' => perm_FolderSPerm::flagPower($cloud['bz']), 'perm' => perm_binPerm::getGroupPower('all'), 'flag' => $cloud['bz'], 'iconview' => 1, 'disp' => '0');
     return $data;
 }
开发者ID:druphliu,项目名称:dzzoffice,代码行数:7,代码来源:table_connect_ftp.php

示例15: usesubmit

 function usesubmit()
 {
     global $_G;
     if (empty($_G['gp_pid'])) {
         showmessage(lang('magic/repent', 'repent_info_nonexistence'));
     }
     $_G['tid'] = $_G['gp_ptid'];
     $post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status'));
     $this->_check($post);
     require_once libfile('function/post');
     require_once libfile('function/delete');
     if ($post['first']) {
         if ($have_replycredit = DB::fetch_first("SELECT * FROM " . DB::table('forum_replycredit') . " WHERE tid ='{$post['tid']}' LIMIT 1")) {
             if ($replycredit = DB::result_first("SELECT replycredit FROM " . DB::table('forum_thread') . " WHERE tid = '{$post['tid']}'")) {
                 updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit));
             }
             DB::delete('forum_replycredit', "tid = '{$post['tid']}'");
             DB::delete('common_credit_log', "operation IN ('RCT', 'RCA', 'RCB') AND relatedid IN({$post['tid']})");
         }
         deletethread(array($post['tid']));
         updateforumcount($post['fid']);
     } else {
         if ($post['replycredit'] > 0) {
             updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit']));
             DB::delete('common_credit_log', "uid = '{$post['authorid']}' AND operation = 'RCA' AND relatedid IN({$post['tid']})");
         }
         deletepost(array($_G['gp_pid']));
         updatethreadcount($post['tid']);
     }
     usemagic($this->magic['magicid'], $this->magic['num']);
     updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']);
     showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('showdialog' => 1, 'locationtime' => true));
 }
开发者ID:pan289091315,项目名称:Discuz,代码行数:33,代码来源:magic_repent.php


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