本文整理汇总了PHP中FDB::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP FDB::fetchAll方法的具体用法?PHP FDB::fetchAll怎么用?PHP FDB::fetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FDB
的用法示例。
在下文中一共展示了FDB::fetchAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: m_getMConfig
function m_getMConfig()
{
global $_FANWE;
//FanweService::instance()->cache->loadCache("m_config");
$m_config = $_FANWE['cache']['m_config'];
if ($m_config == false) {
//init_config_data();//检查初始化数据
$m_config = array();
$list = FDB::fetchAll("select code,val from " . FDB::table("m_config"));
foreach ($list as $item) {
$m_config[$item['code']] = $item['val'];
}
//新闻公告
$sql = "select code as title, title as content from " . FDB::table("m_config_list") . " where `group` = 4 and is_verify = 1 order by id desc";
$list = FDB::fetchAll($sql);
$newslist = array();
foreach ($list as $item) {
$newslist[] = array("title" => $item['title'], "content" => str_replace("/public/upload/images/", $_FANWE['site_url'] . "public/upload/images/", $item['content']));
}
$m_config['newslist'] = $newslist;
//print_r($addrtlist);exit;
FanweService::instance()->cache->saveCache("m_config", $m_config);
}
//print_r($m_config);
return $m_config;
}
示例2: 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();
}
示例3: getList
public function getList($uid)
{
$uid = (int) $uid;
$list = FDB::fetchAll('SELECT *
FROM ' . FDB::table('sys_notice') . '
WHERE uid = ' . $uid . '
ORDER BY id DESC');
FDB::query("UPDATE " . FDB::table('sys_notice') . " SET status = 1 WHERE uid='{$uid}' AND status = 0");
return $list;
}
示例4: getUUIndexShop
/**
*
*/
function getUUIndexShop()
{
global $_FANWE;
$args = array();
$cache_file = getTplCache('inc/index/shop', array(), 1);
if (getCacheIsUpdate($cache_file, 600)) {
$args['shop_list'] = FDB::fetchAll('SELECT * FROM ' . FDB::table('shop') . ' WHERE shop_logo <>\'\' ORDER BY sort desc, shop_id asc limit 0,30 ');
}
return tplFetch('inc/index/shop', $args, '', $cache_file);
}
示例5: getSysMsgs
/**
* 获取系统信件列表
* @return void
*/
public function getSysMsgs($uid)
{
$list = FDB::fetchAll('SELECT *
FROM ' . FDB::table('sys_msg_member') . ' AS mm
LEFT JOIN ' . FDB::table('sys_msg') . ' AS m ON m.mid = mm.mid
WHERE mm.status < 2 AND mm.uid = ' . $uid . '
ORDER BY m.mid DESC');
FDB::query("UPDATE " . FDB::table('sys_msg_member') . " SET status = 1 WHERE uid='{$uid}' AND status = 0");
return $list;
}
示例6: addgoods
public function addgoods()
{
$share_module = FDB::fetchAll("select `name`,`class`,`icon`,`url` from " . FDB::table('sharegoods_module') . " where status = 1 and is_install = 1");
global $_FANWE;
$cache_file = getTplCache('inc/shareutil/addgoods');
if (!@(include $cache_file)) {
include template('inc/shareutil/addgoods');
}
display($cache_file);
}
示例7: m_express
function m_express($content)
{
global $_FANWE;
$express = getCache('m_emotion_express_cache');
//缓存过的表情hash
if (!$express) {
$express_rs = FDB::fetchAll("select `emotion`,concat('" . $_FANWE['site_url'] . "public/expression/',`type`,'/',`filename`) as fname from " . FDB::table('expression'));
foreach ($express_rs as $k => $row) {
$express[0][] = $row['emotion'];
$express[1][] = "<img src='" . $row['fname'] . "' title='" . preg_replace("/[\\[\\]]/", '', $row['emotion']) . "' />";
}
setCache('m_emotion_express_cache', $express);
}
$content = str_replace($express[0], $express[1], $content);
$parse_user = array();
preg_match_all("/@([^\f\n\r\t\v@<> ]{2,20}?)(?:\\:| )/", $content, $users);
if (!empty($users[1])) {
$patterns = array();
$replace = array();
$users = array_unique($users[1]);
$arr = array();
foreach ($users as $user) {
if (!empty($user)) {
$arr[] = addslashes($user);
}
}
$res = FDB::query('SELECT uid,user_name
FROM ' . FDB::table('user') . '
WHERE user_name ' . FDB::createIN($arr));
while ($data = FDB::fetch($res)) {
$parse_user[$data['user_name']] = $data['uid'];
}
}
$parse_events = array();
preg_match_all("/#([^\f\n\r\t\v]{1,80}?)#/", $content, $events);
if (!empty($events[1])) {
$patterns = array();
$replace = array();
$events = array_unique($events[1]);
$arr = array();
foreach ($events as $event) {
if (!empty($event)) {
$arr[] = addslashes($event);
}
}
$res = FDB::query('SELECT id,title
FROM ' . FDB::table('event') . '
WHERE title ' . FDB::createIN($arr));
while ($data = FDB::fetch($res)) {
$parse_events[$data['title']] = $data['id'];
}
}
return array("users" => $parse_user, "events" => $parse_events);
}
示例8: getHotUser
/**
* 热心排行榜
*/
function getHotUser()
{
$cache_file = getTplCache('inc/ask/hot_user', array(), 1);
if (getCacheIsUpdate($cache_file, 300)) {
//热心排行榜
$sql = "SELECT uc.uid,u.user_name,uc.ask,ask_posts,uc.ask_best_posts \r\n\t\t\tFROM " . FDB::table("user_count") . " AS uc \r\n\t\t\tINNER JOIN " . FDB::table("user") . " AS u ON u.uid = uc.uid \r\n\t\t\tORDER BY uc.ask_best_posts DESC ,uc.ask_posts DESC limit 10";
$hot_users = FDB::fetchAll($sql);
$args['hot_users'] =& $hot_users;
}
return tplFetch('inc/ask/hot_user', $args, '', $cache_file);
}
示例9: searchShop
public function searchShop()
{
vendor("common");
$kw = trim($_REQUEST['kw']);
$result['kw'] = $kw;
$shop_list = FDB::fetchAll("select * from " . FDB::table("shop") . " where shop_name like '%" . $kw . "%' order by rand() limit 20 ");
$shop_count = intval(FDB::resultFirst("select count(*) from " . FDB::table("shop") . " where shop_name like '%" . $kw . "%'"));
$result['shop_list'] = $shop_list;
$result['shop_count'] = $shop_count;
die(json_encode($result));
}
示例10: getAlbumListByUid
public function getAlbumListByUid($uid, $limit = '')
{
$uid = (int) $uid;
if (!$uid) {
return false;
}
if (empty($limit)) {
return FDB::fetchAll('SELECT * FROM ' . FDB::table('album') . ' WHERE uid = ' . $uid . ' ORDER BY id DESC');
} else {
return FDB::fetchAll('SELECT * FROM ' . FDB::table('album') . ' WHERE uid = ' . $uid . ' ORDER BY id DESC LIMIT ' . $limit);
}
}
示例11: bindCacheUsercate
function bindCacheUsercate()
{
$categorys = array();
$res = FDB::query("SELECT * FROM " . FDB::table('user_category') . " WHERE status = 1");
while ($data = FDB::fetch($res)) {
$data['tags'] = FDB::fetchAll('SELECT ut.*
FROM ' . FDB::table('user_category_tags') . ' AS uct
INNER JOIN ' . FDB::table('user_tags') . ' AS ut ON ut.tag_id = uct.tag_id
WHERE uct.cate_id = ' . $data['id'] . ' ORDER BY ut.sort ASC,ut.tag_id ASC');
$categorys[$data['id']] = $data;
}
FanweService::instance()->cache->saveCache('usertagcate', $categorys);
}
示例12: run
public function run()
{
global $_FANWE;
$root = array();
$root['return'] = 0;
$uid = $_FANWE['uid'];
if ($uid == 0) {
$root['info'] = "请先登陆";
m_display($root);
}
$root['home_user'] = $_FANWE['user'];
$page = (int) $_FANWE['requestData']['page'];
$page = max(1, $page);
$uids = array();
//获取我关注的会员编号
$sql = 'SELECT uid
FROM ' . FDB::table('user_follow') . '
WHERE f_uid = ' . $uid;
$res = FDB::query($sql);
while ($data = FDB::fetch($res)) {
$uids[] = (int) $data['uid'];
}
if (count($uids) > 0) {
$sql = 'SELECT COUNT(share_id) FROM ' . FDB::table("share") . ' WHERE uid IN (' . implode(',', $uids) . ')';
$total = FDB::resultFirst($sql);
$page_size = PAGE_SIZE;
$page_total = max(1, ceil($total / $page_size));
if ($page > $page_total) {
$page = $page_total;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$share_list = array();
$sql = 'SELECT * FROM ' . FDB::table("share") . ' WHERE uid IN (' . implode(',', $uids) . ') ORDER BY share_id DESC LIMIT ' . $limit;
$share_list = FDB::fetchAll($sql);
$share_list = mGetShareDetailList($share_list, true);
} else {
$page_total = 0;
$share_list = array();
}
$root['return'] = 1;
if (count($share_list) > 0) {
$root['item'] = array_slice($share_list, 0);
} else {
$root['item'] = array();
}
$root['page'] = array("page" => $page, "page_total" => $page_total);
m_display($root);
}
示例13: target
public function target()
{
define("ACTION_NAME", "target");
if (intval($GLOBALS['fanwe']->var['uid']) == 0) {
fHeader("location: " . FU('user/login'));
}
global $_FANWE;
$sql = "select f.f_uid as uid,u.user_name from " . FDB::table("user_follow") . " as f left join " . FDB::table("user") . " as u on f.f_uid = u.uid where f.uid = " . intval($GLOBALS['fanwe']->var['uid']);
$sql_count = "select count(f.f_uid) from " . FDB::table("user_follow") . " as f left join " . FDB::table("user") . " as u on f.f_uid = u.uid where f.uid = " . intval($GLOBALS['fanwe']->var['uid']);
$page_size = 21;
$count = FDB::resultFirst($sql_count);
$pager = buildPage('message/target', array(), $count, $_FANWE['page'], $page_size);
$sql = $sql . " limit " . $pager['limit'];
$follow_user = FDB::fetchAll($sql);
include template('page/message_target');
display();
}
示例14: getCatalogArray
function getCatalogArray()
{
global $_FANWE;
$categorylist = $_FANWE['cache']['merchant_category'];
if ($categorylist == false) {
//init_config_data();//检查初始化数据
$categorylist = array();
//$region_lv2 = array();
$list = FDB::fetchAll("select * from " . FDB::table("merchant_category") . " where status = 1");
//print_r($list);exit
foreach ($list as $item) {
$categorylist[] = array("id" => $item['id'], "name" => $item['name'], "icon" => $_FANWE['site_url'] . $item['icon']);
}
//print_r($categorylist);exit;
FanweService::instance()->cache->saveCache("merchant_category", $categorylist);
}
return $categorylist;
}
示例15: syn_weibo
function syn_weibo($uid)
{
global $_FANWE;
static $mods = array();
$_FANWE['uid'] = $uid;
$weibos = FDB::fetchAll("select * from " . FDB::table("pub_schedule") . " where uid = " . $uid . " order by type");
FDB::query("delete from " . FDB::table("pub_schedule") . " where uid = " . $uid);
foreach ($weibos as $weibo) {
if (file_exists(FANWE_ROOT . "login/" . $weibo['type'] . ".php")) {
if (!isset($mods[$weibo['type']])) {
require_once FANWE_ROOT . "login/" . $weibo['type'] . ".php";
$class = $weibo['type'];
$mods[$weibo['type']] = new $class();
}
$data = unserialize(base64_decode($weibo['data']));
$mods[$weibo['type']]->sendMessage($data);
}
}
}