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


PHP FDB::fetchFirst方法代码示例

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


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

示例1: __construct

 public function __construct($url)
 {
     global $_FANWE;
     FanweService::instance()->cache->loadCache('business');
     $rs = preg_match("/^(http:\\/\\/|https:\\/\\/)/", $url, $match);
     if (intval($rs) == 0) {
         $url = "http://" . $url;
     }
     $rs = parse_url($url);
     $scheme = isset($rs['scheme']) ? $rs['scheme'] . "://" : "http://";
     $host = isset($rs['host']) ? $rs['host'] : "none";
     $host = explode('.', $host);
     $host = array_slice($host, -2, 2);
     $domain = implode('.', $host);
     $class = FDB::fetchFirst("select `class` from " . FDB::table('sharegoods_module') . " where domain like '%" . $domain . "%' and status = 1  limit 1");
     $class = $class['class'];
     $file = FANWE_ROOT . "core/class/sharegoods/" . $class . "_sharegoods.class.php";
     require_once FANWE_ROOT . "core/class/sharegoods/sharegoods.php";
     require_once FANWE_ROOT . "core/class/string.class.php";
     if (file_exists($file) && isset($_FANWE['cache']['business'][$class])) {
         require_once $file;
         $class_name = $class . "_sharegoods";
         if (class_exists($class_name)) {
             $this->share_module = new $class_name();
         }
     }
     $this->url = $url;
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:28,代码来源:sharegoods.service.php

示例2: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 1;
        $root['act'] = 'delcomment';
        if ($_FANWE['uid'] == 0) {
            exit;
        }
        $comment_id = intval($_FANWE['requestData']['id']);
        if ($comment_id == 0) {
            exit;
        }
        $share = FDB::fetchFirst('SELECT s.uid,s.share_id  
			FROM ' . FDB::table('share_comment') . ' AS sc 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sc.share_id 
			WHERE sc.comment_id = ' . $comment_id);
        if (empty($share)) {
            exit;
        }
        $uid = intval($share['uid']);
        if ($uid != $_FANWE['uid']) {
            exit;
        }
        FS('Share')->deleteShareComment($comment_id);
        $root['return'] = 1;
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:28,代码来源:delcomment.mapi.php

示例3: getUserByTypeKeyId

    public function getUserByTypeKeyId($type, $key_id)
    {
        $sql = 'SELECT u.uid,u.password,u.status FROM ' . FDB::table('user_bind') . ' as ub 
			INNER JOIN ' . FDB::table('user') . ' as u ON u.uid = ub.uid 
			WHERE ub.type = \'' . $type . '\' AND ub.keyid = \'' . $key_id . '\'';
        return FDB::fetchFirst($sql);
    }
开发者ID:yakrsa,项目名称:football,代码行数:7,代码来源:userbase.class.php

示例4: read

 /**
  * 读取Session
  * @access public
  * @param string $session_id
  * @return string
  */
 public function read($session_id)
 {
     $sql = "SELECT session_data AS data FROM " . $this->sessionTable . " WHERE session_id = '{$session_id}'   AND session_expire >" . time();
     $res = FDB::fetchFirst($sql);
     if ($res) {
         return $res['data'];
     }
     return "";
 }
开发者ID:fanshengshuai,项目名称:flib,代码行数:15,代码来源:FSession.php

示例5: get

 /**
  * 获取统计信息
  * @param int $uid 会员编号
  * @param string $type 类型
  * @return
  */
 public function get($uid, $type)
 {
     $uid = (int) $uid;
     $type = StatisticsService::getTypeByKey($type);
     if (!$type || !$uid) {
         return array();
     }
     return FDB::fetchFirst('SELECT * FROM ' . FDB::table('user_statistics') . ' WHERE uid = ' . $uid . ' AND type = ' . $type);
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:15,代码来源:statistics.service.php

示例6: detail

    public function detail()
    {
        global $_FANWE;
        $id = intval($_FANWE['request']['id']);
        if ($id == 0) {
            fHeader("location: " . FU('index/index'));
        }
        include fimport('dynamic/u');
        //获取相关的分享ID
        $eventinfo = FDB::fetchFirst("select * from " . FDB::table("event") . " where id=" . $id);
        if (intval($eventinfo['share_id']) == 0) {
            fHeader("location: " . FU('index/index'));
        }
        $eventinfo['share'] = FS('Share')->getShareDetail($eventinfo['share_id']);
        if ($share_detail === false) {
            fHeader("location: " . FU('index'));
        }
        $user_share_collect = FS('Share')->getShareCollectUser($eventinfo['share_id']);
        $page_title = preg_replace("/\\[[^\\]]+\\]/i", "", $eventinfo['title']);
        $_FANWE['nav_title'] = $page_title . ' - ' . lang('common', 'event');
        $_FANWE['seo_description'] = $page_title;
        $_FANWE['setting']['site_description'] = '';
        //分享评论
        $page_args = array('id' => $id);
        $count = $eventinfo['thread_count'];
        $post_list = array();
        if ($count > 0) {
            $pager = buildPage('event/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 10);
            $sql = 'SELECT share_id FROM ' . FDB::table('event_share') . ' 
				WHERE event_id = ' . $id . ' ORDER BY share_id DESC LIMIT ' . $pager['limit'];
            $ids = array();
            $res = FDB::query($sql);
            while ($data = FDB::fetch($res)) {
                $ids[] = $data['share_id'];
            }
            $ids = implode(',', $ids);
            $sql = 'SELECT * from ' . FDB::table('share') . ' where share_id IN (' . $ids . ') ORDER BY share_id';
            $list = FDB::fetchAll($sql);
            $post_list = FS('Share')->getShareDetailList($list, true, true, true);
        }
        $args = array('share_list' => &$post_list, 'pager' => &$pager, 'current_share_id' => $eventinfo['share_id']);
        $post_html = tplFetch("inc/share/post_share_list", $args);
        //热门话题
        $hot_event_list = FS("event")->getHotEvent(10);
        if (intval($_FANWE['uid']) > 0) {
            //我发布的
            $me_event_list = FS("event")->getUserEvent($_FANWE['uid'], 5);
            //我参与的
            $me_join_event_list = FS("event")->getUserJoinevent($_FANWE['uid'], 5);
        }
        if (intval($_FANWE['page']) == 1) {
            FDB::query('UPDATE ' . FDB::table('share') . ' SET click_count = click_count + 1 WHERE share_id = ' . $eventinfo['share_id']);
        }
        include template('page/event/event_detail');
        display();
    }
开发者ID:dalinhuang,项目名称:concourse,代码行数:56,代码来源:event.module.php

示例7: edit

 public function edit()
 {
     vendor("common");
     $name = $this->getActionName();
     $vo = M($name)->getByGoodsId($_REQUEST['goods_id']);
     $this->assign('vo', $vo);
     //$category = FDB::fetchAll("select cate_id,cate_name from ".FDB::table("goods_category")." where parent_id = 0");
     //$this->assign ( 'category', $category );
     $shop = FDB::fetchFirst("select shop_name,shop_id from " . FDB::table("shop") . " where shop_id = " . $vo['shop_id']);
     $this->assign('shop', $shop);
     $this->display();
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:12,代码来源:ShareGoodsAction.class.php

示例8: ajaxLogin

 public function ajaxLogin()
 {
     global $_FANWE;
     $user_name_or_email = addslashes($_FANWE['request']['email_name']);
     $password = md5(trim($_FANWE['request']['pass']));
     $life = isset($_FANWE['request']['remember']) ? intval($_FANWE['request']['remember']) : 0;
     $rhash = $_FANWE['request']['rhash'];
     if (empty($rhash) || $rhash != FORM_HASH) {
         exit('Access Denied');
     }
     $return = array();
     $user_field = $_FANWE['setting']['integrate_field_id'];
     $sql = "SELECT uid,status,{$user_field} FROM " . FDB::table('user') . " WHERE (email = '{$user_name_or_email}' OR user_name = '{$user_name_or_email}') AND password = '{$password}'";
     $user_info = FDB::fetchFirst($sql);
     $uid = intval($user_info['uid']);
     $integrate_id = intval($user_info[$user_field]);
     //===========add by chenfq 2011-10-14==========================
     if ($uid <= 0) {
         $uid = FS("Integrate")->addUserToLoacl($user_name_or_email, $password, 1);
         //重新取一下当前数据库的用户数据
         $sql = "SELECT uid,{$user_field} FROM " . FDB::table('user') . " WHERE uid = '{$uid}'";
         $user_info = FDB::fetchFirst($sql);
         $uid = intval($user_info['uid']);
         $integrate_id = intval($user_info[$user_field]);
     }
     //===========add by chenfq 2011-10-14==========================
     if ($uid > 0) {
         if ($user_info['status'] == 0) {
             $return['status'] = 2;
             outputJson($return);
             exit;
         }
         $user = array('uid' => $uid, 'password' => $password);
         fSetCookie('last_request', authcode(TIME_UTC - 10, 'ENCODE'), TIME_UTC + 816400, 1, true);
         FS('User')->setSession($user, $life);
         $syslogin_js = FS("Integrate")->synLogin($integrate_id);
         //js 需要在前台执行 add by chenfq 2011-10-15
         //$return['syslogin_js'] = $syslogin_js;
         if (!empty($syslogin_js)) {
             fSetCookie("dynamic_script", $syslogin_js);
         }
         $return['status'] = 1;
         $return['uid'] = $uid;
         if (getCookie('redir_url')) {
             //判断采集图片回调地址,cookie中保持的地址,只使用一次
             unset($_FANWE['cookie']['redir_url']);
         }
     } else {
         $return['status'] = 0;
     }
     outputJson($return);
 }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:52,代码来源:user.module.php

示例9: collectCates

 public function collectCates()
 {
     setTimeLimit(3600);
     $ccate = FDB::fetchFirst('SELECT * FROM ' . FDB::table('goods_cate_collect') . ' LIMIT 0,1');
     if (!$ccate) {
         return false;
     }
     FDB::query('DELETE FROM ' . FDB::table('goods_cate_collect') . " WHERE id = '{$ccate['id']}'");
     global $_FANWE;
     Cache::getInstance()->loadCache('business');
     //QQ号
     define('PAIPAI_API_UIN', trim($_FANWE['cache']['business']['paipai']['uin']));
     //令牌
     define('PAIPAI_API_APPOAUTHID', trim($_FANWE['cache']['business']['paipai']['appoauthid']));
     //APP_KEY
     define('PAIPAI_API_APPOAUTHKEY', trim($_FANWE['cache']['business']['paipai']['appoauthkey']));
     define('PAIPAI_API_ACCESSTOKEN', trim($_FANWE['cache']['business']['paipai']['accesstoken']));
     define('PAIPAI_API_USERID', trim($_FANWE['cache']['business']['paipai']['userid']));
     $sdk = new PaiPaiOpenApiOauth(PAIPAI_API_APPOAUTHID, PAIPAI_API_APPOAUTHKEY, PAIPAI_API_ACCESSTOKEN, PAIPAI_API_UIN);
     $sdk->setApiPath("/attr/getNavigationChildList.xhtml");
     $sdk->setMethod("get");
     $sdk->setCharset("utf-8");
     $sdk->setFormat("json");
     $params =& $sdk->getParams();
     $params["navigationId"] = $ccate['cid'];
     //请求数据
     $json = $sdk->invoke();
     $json = preg_replace("/[\r\n]/", '', $json);
     preg_match("/getNavigationChildListSuccess\\((.+?)\\);\\}catch\\(/", $json, $list);
     $list = json_decode($list[1], true);
     $sort_file = FANWE_ROOT . '/public/records/cate.sort.php';
     $sort = (int) @file_get_contents($sort_file);
     if (isset($list['childList'])) {
         foreach ($list['childList'] as $item) {
             $cate = array();
             $cate['type'] = 'paipai';
             $cate['id'] = (int) $item['navigationId'];
             if ($cate['id'] > 0) {
                 $cate['pid'] = $ccate['cid'] == 0 ? '' : $ccate['cid'];
                 $cate['name'] = (string) $item['navigationName'];
                 $cate['pids'] = empty($ccate['pids']) ? $cate['pid'] : $ccate['pids'] . ',' . $cate['pid'];
                 $cate['sort'] = ++$sort;
                 FDB::insert('goods_cates', $cate, false, true);
                 if ((int) $item['isClass'] == 0) {
                     FDB::insert('goods_cate_collect', array('id' => 'NULL', 'cid' => $cate['id'], 'pids' => $cate['pids']));
                 }
             }
         }
         @file_put_contents($sort_file, $sort);
     }
     return true;
 }
开发者ID:yakrsa,项目名称:football,代码行数:52,代码来源:paipai.class.php

示例10: init

 function init($sid, $ip, $uid)
 {
     $this->old = array('sid' => $sid, 'ip' => $ip, 'uid' => $uid);
     $session = array();
     if ($sid) {
         $session = FDB::fetchFirst("SELECT * FROM " . FDB::table('sessions') . " WHERE sid='{$sid}' AND CONCAT_WS('.', ip1,ip2,ip3,ip4)='{$ip}'");
     }
     if (empty($session) || $session['uid'] != $uid) {
         $session = $this->create($ip, $uid);
     }
     $this->var = $session;
     $this->sid = $session['sid'];
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:13,代码来源:session.class.php

示例11: removeEvent

 function removeEvent($id)
 {
     $id = (int) $id;
     $event = FDB::fetchFirst("select id from " . FDB::table("event") . " where id = {$id}");
     if ($event) {
         $res = FDB::query("select share_id from " . FDB::table("event_share") . " where event_id = {$id}");
         while ($data = FDB::fetch($res)) {
             FS('Share')->deleteShare($data['share_id']);
         }
         FDB::delete("event_share", "event_id = {$id}");
         FS('Share')->deleteShare($event['share_id']);
         FDB::delete("event", "id = {$id}");
     }
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:14,代码来源:event.service.php

示例12: deleteGoods

    public function deleteGoods($gid)
    {
        global $_FANWE;
        $gid = (int) $gid;
        $goods = FDB::fetchFirst('SELECT *
			FROM ' . FDB::table('second_goods') . ' WHERE gid = ' . $gid);
        if (empty($goods)) {
            return;
        }
        $share_id = $goods['share_id'];
        $share = FS('Share')->getShareById($share_id);
        FS('Share')->deleteShare($share_id);
        FDB::query('UPDATE ' . FDB::table('user') . ' SET seconds = seconds - 1 WHERE uid = ' . $share['uid']);
        FS('Medal')->runAuto($share['uid'], 'seconds');
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:15,代码来源:second.service.php

示例13: show

 public function show()
 {
     global $_FANWE;
     $adv_id = intval($_FANWE['request']['id']);
     $adv = FDB::fetchFirst('SELECT url FROM ' . FDB::table('adv') . ' WHERE id = ' . $adv_id . ' AND status = 1');
     if ($adv) {
         if (!empty($adv['url'])) {
             fHeader('Location:' . $adv['url']);
         } else {
             fHeader('Location:./');
         }
     } else {
         fHeader('Location:./');
     }
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:15,代码来源:adv.module.php

示例14: run

 public function run()
 {
     global $_FANWE;
     $root = array();
     $root['return'] = 0;
     //print_r($_FANWE['requestData']);
     $user_name_or_email = addslashes($_FANWE['requestData']['email']);
     $password = md5(trim($_FANWE['requestData']['pwd']));
     if ($user_name_or_email == '') {
         $root['info'] = '登陆帐户不能为空';
         m_display($root);
     }
     $user_field = $_FANWE['setting']['integrate_field_id'];
     $sql = "SELECT uid,status,{$user_field},server_code FROM " . FDB::table('user') . " WHERE (email = '{$user_name_or_email}' OR user_name = '{$user_name_or_email}') AND password = '{$password}'";
     //echo $sql;
     $user_info = FDB::fetchFirst($sql);
     //print_r($user_info);exit;
     $uid = intval($user_info['uid']);
     $integrate_id = intval($user_info[$user_field]);
     //===========add by chenfq 2011-10-14==========================
     if ($uid <= 0) {
         $uid = FS("Integrate")->addUserToLoacl($user_name_or_email, $password, 1);
         //重新取一下当前数据库的用户数据
         $sql = "SELECT uid,{$user_field},status,server_code FROM " . FDB::table('user') . " WHERE uid = '{$uid}'";
         $user_info = FDB::fetchFirst($sql);
         $uid = intval($user_info['uid']);
         $integrate_id = intval($user_info[$user_field]);
     }
     //===========add by chenfq 2011-10-14==========================
     //echo $uid; exit;
     if ($uid > 0) {
         if ($user_info['status'] == 0) {
             m_display($root);
         }
         $root['uid'] = $uid;
         $root['user_avatar'] = avatar($uid, 'b', $user_info['server_code'], 1, true);
         $root['home_user'] = FS("User")->getUserById($uid);
         $root['return'] = 1;
         $deviceuid = addslashes(trim($_FANWE['requestData']['deviceuid']));
         $sql = "update " . FDB::table('apns_devices') . " set clientid = " . $uid . " where clientid = 0 and deviceuid = '" . $deviceuid . "'";
         FDB::query($sql);
     } else {
         $root['info'] = '帐户不存在或密码错误';
     }
     m_display($root);
 }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:46,代码来源:login.mapi.php

示例15: show

    public function show()
    {
        global $_FANWE;
        $id = (int) $_FANWE['request']['id'];
        if (!$id) {
            exit;
        }
        $shop = FDB::fetchFirst('SELECT * FROM ' . FDB::table('shop') . ' WHERE shop_id = ' . $id);
        if (!$shop) {
            fHeader("location: " . FU('shop/index'));
        }
        $_FANWE['nav_title'] = $shop['shop_name'] . ' - ' . $_FANWE['nav_title'];
        $cache_data = fStripslashes(unserialize($shop['data']));
        $shop['tags'] = $cache_data['tags'];
        if (empty($shop['taoke_url'])) {
            $shop['to_url'] = FU('tgo', array('url' => $shop['shop_url']));
        } else {
            $shop['to_url'] = FU('tgo', array('url' => $shop['taoke_url']));
        }
        $page_args['id'] = $id;
        $sql = 'SELECT COUNT(DISTINCT sg.share_id) FROM ' . FDB::table('share_goods') . ' AS sg 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id 
			WHERE s.status = 1 AND sg.shop_id = ' . $id;
        $share_count = FDB::resultFirst($sql);
        $page_size = 20;
        $pager = buildPage('shop/show', $page_args, $share_count, $_FANWE['page'], $page_size);
        $share_ids = array();
        $sql = 'SELECT DISTINCT sg.share_id FROM ' . FDB::table('share_goods') . ' AS sg 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id 
			WHERE s.status = 1 AND sg.shop_id = ' . $id . ' ORDER BY sg.share_id DESC LIMIT ' . $pager['limit'];
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $share_ids[] = $data['share_id'];
        }
        $share_list = array();
        if (count($share_ids) > 0) {
            $share_ids = implode(',', $share_ids);
            $sql = 'SELECT * FROM ' . FDB::table('share') . ' WHERE share_id IN (' . $share_ids . ') ORDER BY share_id DESC';
            $share_list = FDB::fetchAll($sql);
            $share_list = FS('Share')->getShareDetailList($share_list, false, true, true, false, 0, 10);
        }
        $shops_tags = FS('Shop')->getUserOtherShopAndTags($id);
        include template('page/shop/shop_show');
        display();
    }
开发者ID:dalinhuang,项目名称:concourse,代码行数:45,代码来源:shop.module.php


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