本文整理汇总了PHP中pdo_fetchall函数的典型用法代码示例。如果您正苦于以下问题:PHP pdo_fetchall函数的具体用法?PHP pdo_fetchall怎么用?PHP pdo_fetchall使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdo_fetchall函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doWebList
public function doWebList()
{
global $_W, $_GPC;
$table = 'p_room';
$Room = trim($_GPC['Room']);
$status = trim($_GPC['status']);
$sel_build = trim($_GPC['build']);
$project = biz_unserializer($_W['project'], 'builds');
$build = db_getBuilds($_W['project']['projguid'], '', !empty($project));
//$default = 0;
$condition = " WHERE ProjGUID=:ProjGUID ";
$param = array(":ProjGUID" => $_W['project']['projguid']);
if (!empty($Room)) {
$condition .= " AND Room LIKE '%{$Room}%' ";
$_GET['Room'] = $_GPC['Room'];
}
if (!empty($status)) {
$condition .= " AND Status LIKE '%{$status}%' ";
$_GET['status'] = $_GPC['status'];
}
if (!empty($sel_build)) {
$condition .= " AND BldGUID=:BldGUID ";
$param[':BldGUID'] = $sel_build;
$_GET['build'] = $sel_build;
}
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$sql = "SELECT * FROM " . tablename($table) . $condition;
$sql .= " order by RoomCode limit " . ($pindex - 1) * $psize . "," . $psize;
$list = pdo_fetchall($sql, $param);
$total = pdo_fetchcolumn(" select count(*) from " . tablename($table) . $condition, $param);
$pager = pagination($total, $pindex, $psize);
include $this->template('build_list');
}
示例2: respond
public function respond()
{
global $_W;
$content = $this->message['content'];
//这里定义此模块进行消息处理时的具体过程, 请查看WORMWOOD文档来编写你的代码
$isfill = pdo_fetchcolumn("SELECT isfill FROM " . tablename('feng_testingreply') . " WHERE rid =:rid AND testingid = '0'", array(':rid' => $this->rule));
$reply = pdo_fetchall("SELECT * FROM " . tablename('feng_testingreply') . " WHERE rid = :rid", array(':rid' => $this->rule));
if (!empty($reply)) {
foreach ($reply as $row) {
$ids[$row['testingid']] = $row['testingid'];
}
$article = pdo_fetchall("SELECT id,title,photo,smalltext FROM " . tablename('feng_testing') . " WHERE id IN (" . implode(',', $ids) . ")", array(), 'id');
}
if ($isfill && ($count = 8 - count($reply)) > 0) {
$articlefill = pdo_fetchall("SELECT id,title,photo,smalltext FROM " . tablename('feng_testing') . " WHERE weid = '{$_W['weid']}' AND id NOT IN (" . implode(',', $ids) . ") ORDER BY id DESC LIMIT {$count}", array(), 'id');
if (!empty($articlefill)) {
foreach ($articlefill as $row) {
$article[$row['id']] = $row;
$reply[]['testingid'] = $row['id'];
}
unset($articlefill);
}
}
if (!empty($reply)) {
$response = array();
foreach ($reply as $row) {
$row = $article[$row['testingid']];
if (!empty($row)) {
$response[] = array('title' => $row['title'], 'description' => $row['description'], 'picurl' => $row['thumb'], 'url' => $this->buildSiteUrl($this->createMobileUrl('detail', array('id' => $row['id']))));
}
}
}
return $this->respNews($response);
}
示例3: getCategory
public function getCategory()
{
global $_W;
$shopset = m('common')->getSysset('shop');
$allcategory = array();
$category = pdo_fetchall("SELECT * FROM " . tablename('ewei_shop_category') . " WHERE uniacid=:uniacid and enabled=1 ORDER BY parentid ASC, displayorder DESC", array(':uniacid' => $_W['uniacid']));
$category = set_medias($category, array('thumb', 'advimg'));
foreach ($category as $c) {
if (empty($c['parentid'])) {
$children = array();
foreach ($category as $c1) {
if ($c1['parentid'] == $c['id']) {
if (intval($shopset['catlevel']) == 3) {
$children2 = array();
foreach ($category as $c2) {
if ($c2['parentid'] == $c1['id']) {
$children2[] = $c2;
}
}
$c1['children'] = $children2;
}
$children[] = $c1;
}
}
$c['children'] = $children;
$allcategory[] = $c;
}
}
return $allcategory;
}
示例4: doMobileprivilege
public function doMobileprivilege()
{
global $_GPC, $_W;
$id = intval($_GPC['id']);
$volist = pdo_fetchall("SELECT * FROM " . tablename('market_privilege') . " WHERE weid=:weid and id=:id", array(':id' => $id, ':weid' => $_W['weid']));
include $this->template('privilege');
}
示例5: doWebCategory
public function doWebCategory()
{
global $_GPC, $_W;
$op = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
$id = intval($_GPC['id']);
if ($op == 'post') {
if (!empty($id)) {
$item = pdo_fetch("SELECT * FROM" . tablename('xfmarket_category') . "WHERE id='{$id}'");
}
if ($_W['ispost']) {
$data = array('weid' => $_W['weid'], 'name' => $_GPC['cname'], 'enabled' => $_GPC['enabled']);
if (empty($id)) {
pdo_insert('xfmarket_category', $data);
} else {
pdo_update('xfmarket_category', $data, array('id' => $id));
}
message('更新成功', referer(), 'success');
}
} elseif ($op == 'display') {
$row = pdo_fetchall("SELECT * FROM" . tablename('xfmarket_category') . "WHERE weid='{$_W['weid']}'");
}
if (checksubmit('delete')) {
pdo_delete('xfmarket_category', " id IN ('" . implode("','", $_GPC['select']) . "')");
message('删除成功', referer(), 'success');
}
include $this->template('category');
}
示例6: doMobileshow
public function doMobileshow()
{
global $_W, $_GPC;
$rid = $_GPC['id'];
$sql = "SELECT * FROM " . tablename($this->tablename_log) . " WHERE `rid`=:rid";
$info = pdo_fetchall($sql, array(':rid' => $rid));
$sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `rid`=:rid LIMIT 1";
$quiz = pdo_fetch($sql, array(':rid' => $rid));
$sql = "SELECT * FROM " . tablename($this->tablename_question) . " WHERE `id`=:id";
$q = pdo_fetch($sql, array(':id' => $quiz['qid']));
//var_dump($q);
$arr = array();
foreach ($info as $key => $value) {
$arr[] = $info[$key]['chk_answer'];
}
$per = array_count_values($arr);
ksort($per);
//var_dump($per);
$total_count = sizeof($info);
$config = $this->get_config($q);
//foreach($per as $key => $value){
//$str .= '选项'.$key.'次数'.$value;
//}
//var_dump($str);
//var_dump($per);
include $this->template('show');
}
示例7: site_article
function site_article($params = array())
{
global $_GPC, $_W;
extract($params);
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$result = array();
$condition = " WHERE weid = '{$_W['weid']}'";
if (!empty($cid)) {
$category = pdo_fetch("SELECT parentid FROM " . tablename('category') . " WHERE id = '{$cid}'");
if (!empty($category['parentid'])) {
$condition .= " AND ccate = '{$cid}'";
} else {
$condition .= " AND pcate = '{$cid}'";
}
}
if ($iscommend == 'true') {
$condition .= " AND iscommend = '1'";
}
if ($ishot == 'true') {
$condition .= " AND ishot = '1'";
}
$sql = "SELECT * FROM " . tablename('article') . $condition . ' ORDER BY displayorder DESC, id DESC';
$result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('article') . $condition);
$result['pager'] = pagination($total, $pindex, $psize);
if (!empty($result['list'])) {
foreach ($result['list'] as &$row) {
$row['url'] = create_url('mobile/module/hdetail', array('name' => 'shouse', 'id' => $row['id'], 'weid' => $_W['weid']));
}
}
return $result;
}
示例8: doWebList
public function doWebList()
{
global $_GPC, $_W;
checklogin();
$weid = $_W['account']['weid'];
//当前公众号ID
$id = intval($_GPC['id']);
$condition = '';
if (!empty($_GPC['name'])) {
$condition .= " AND ( grabername LIKE '%{$_GPC['realname']}%' OR fitername LIKE '%{$_GPC['realname']}%' )";
}
if (!empty($_GPC['mobile'])) {
$condition .= " AND ( grabermobile = '{$_GPC['mobile']}' OR fitermobile = '{$_GPC['mobile']}' )";
}
if (checksubmit('delete')) {
pdo_delete('grabseat_record', " id IN ('" . implode("','", $_GPC['select']) . "')");
message('删除成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page'])));
}
if (!empty($_GPC['wid'])) {
$wid = intval($_GPC['wid']);
pdo_update('grabseat_record', array('status' => intval($_GPC['status'])), array('id' => $wid));
message('标识领奖成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page'])));
}
$pindex = max(1, intval($_GPC['page']));
$psize = 25;
$list = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$listtotal = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} ");
$total = count($listtotal);
$pager = pagination($total, $pindex, $psize);
include $this->template('list');
}
示例9: receive
public function receive()
{
global $_W, $_GPC;
load()->func('communication');
$type = $this->message['type'];
$uniacid = $GLOBALS['_W']['uniacid'];
$acid = $GLOBALS['_W']['acid'];
//$uniacid = $_W['acid'];
$rid = intval($this->params['rule']);
$rid = $this->rule;
$openid = $this->message['fromusername'];
$cfg = $this->module['config'];
//file_put_contents(IA_ROOT.'/receive.txt', iserializer($cfg));
if ($this->message['event'] == 'unsubscribe' && $cfg['isopenjsps']) {
$record = array('updatetime' => TIMESTAMP, 'follow' => '0', 'followtime' => TIMESTAMP);
pdo_update('mc_mapping_fans', $record, array('openid' => $openid, 'acid' => $acid, 'uniacid' => $uniacid));
$fmvotelog = pdo_fetchall("SELECT * FROM " . tablename('fm_photosvote_votelog') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $openid, ':uniacid' => $uniacid));
foreach ($fmvotelog as $log) {
$fmprovevote = pdo_fetch("SELECT * FROM " . tablename('fm_photosvote_provevote') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $log['tfrom_user'], ':uniacid' => $uniacid));
pdo_update('fm_photosvote_provevote', array('lasttime' => TIMESTAMP, 'photosnum' => $fmprovevote['photosnum'] - 1, 'hits' => $fmprovevote['hits'] - 1), array('from_user' => $log['tfrom_user'], 'uniacid' => $uniacid));
}
pdo_delete('fm_photosvote_votelog', array('from_user' => $openid));
pdo_delete('fm_photosvote_bbsreply', array('from_user' => $openid));
}
}
示例10: dolist
public function dolist()
{
global $_GPC, $_W;
checklogin();
$weid = intval($_W['weid']);
if (checksubmit('verify') && !empty($_GPC['select'])) {
pdo_update('message_list', array('isshow' => 1, 'create_time' => TIMESTAMP), " id IN ('" . implode("','", $_GPC['select']) . "')");
message('审核成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page'])));
}
if (checksubmit('delete') && !empty($_GPC['select'])) {
pdo_delete('message_list', " id IN ('" . implode("','", $_GPC['select']) . "')");
message('删除成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page'])));
}
$isshow = isset($_GPC['isshow']) ? intval($_GPC['isshow']) : 0;
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$message = pdo_fetch("SELECT id, isshow, weid FROM " . tablename('message_reply') . " WHERE weid = '{$weid}' LIMIT 1");
$list = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}' ORDER BY create_time DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}");
if (!empty($list)) {
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}'");
$pager = pagination($total, $pindex, $psize);
foreach ($list as &$row) {
$row['content'] = emotion($row['content']);
$userids[] = $row['from_user'];
}
unset($row);
}
include $this->template('list');
}
示例11: respond
public function respond()
{
global $_W;
$content = $this->message['content'];
$from_user = $this->message['from'];
$isfill = pdo_fetchcolumn("SELECT isfill FROM " . tablename('xc_article_article_reply') . " WHERE rid =:rid AND articleid = '0'", array(':rid' => $this->rule));
$reply = pdo_fetchall("SELECT * FROM " . tablename('xc_article_article_reply') . " WHERE rid = :rid", array(':rid' => $this->rule));
if (!empty($reply)) {
foreach ($reply as $row) {
$ids[$row['articleid']] = $row['articleid'];
}
$article = pdo_fetchall("SELECT id, title, thumb, content, description, linkurl FROM " . tablename('xc_article_article') . " WHERE id IN (" . implode(',', $ids) . ")", array(), 'id');
}
if ($isfill && ($count = 8 - count($reply)) > 0) {
$articlefill = pdo_fetchall("SELECT id, title, thumb, content, description, linkurl FROM " . tablename('xc_article_article') . " WHERE weid = '{$_W['weid']}' AND id NOT IN (" . implode(',', $ids) . ") ORDER BY id DESC LIMIT {$count}", array(), 'id');
if (!empty($articlefill)) {
foreach ($articlefill as $row) {
$article[$row['id']] = $row;
$reply[]['articleid'] = $row['id'];
}
unset($articlefill);
}
}
if (!empty($reply)) {
$response = array();
foreach ($reply as $row) {
$row = $article[$row['articleid']];
if (!empty($row)) {
$response[] = array('title' => htmlspecialchars_decode($row['title']), 'description' => htmlspecialchars_decode($row['description']), 'picurl' => $row['thumb'], 'url' => $this->buildSiteUrl($this->createMobileUrl('detail', array('id' => $row['id'], 'shareby' => $from_user, 'track_type' => 'click', 'linkurl' => $row['linkurl']))));
}
}
}
return $this->respNews($response);
}
示例12: doMobilelist
public function doMobilelist()
{
global $_GPC, $_W;
$weid = intval($_W['weid']);
//录入bigwheel_fans数据
if (empty($weid)) {
message('抱歉,参数错误!', '', 'error');
}
$reply = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE weid = :weid ORDER BY `id` DESC", array(':weid' => $weid));
if ($reply == false) {
$reply = array('status' => 1, 'isshow' => 1);
}
$messagecount = pdo_fetchcolumn("SELECT count(id) FROM " . tablename('message_list') . " WHERE isshow=1 and weid=" . $weid);
$p = isset($_GET['p']) ? $_GET['p'] : 1;
$pagenum = 10;
$totalpage = floor($messagecount / $pagenum) + 1;
$prow = ($p - 1) * $pagenum;
$messagelist = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid=" . $weid . " and fid=0 and isshow=1 order by create_time desc limit {$prow},{$pagenum}");
foreach ($messagelist as $k => $v) {
$messagelist[$k]['reply'] = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid=" . $weid . " and fid=" . $v['id'] . " and isshow=1 limit 20");
}
//获取fans表中的username
$nickname = pdo_fetchcolumn("Select nickname from " . tablename('fans') . " where weid=" . $weid . " and from_user='" . $_W['fans']['from_user'] . "' limit 1");
include $this->template('list');
}
示例13: selectAllOrderBy
public function selectAllOrderBy($where = '', $order_by = '')
{
global $_W;
$uniacid = $_W['uniacid'];
$data_list = pdo_fetchall("SELECT " . $this->columns . " FROM " . tablename($this->table_name) . " WHERE 1=1 AND uniacid={$uniacid} {$where} ORDER BY {$order_by}id ASC");
return $data_list;
}
示例14: doMobileIndex
public function doMobileIndex()
{
global $_GPC, $_W;
$sql = "select * from" . tablename($this->manage) . "where weid='{$_W['weid']}'";
$list = pdo_fetchall($sql);
include $this->template('index');
}
示例15: all_list
public function all_list($params = array())
{
global $_GPC, $_W;
extract($params);
$result = array();
$pindex = max(1, intval($_GPC['page']));
$psize = $psize ? $psize : '20';
$where = "WHERE `uniacid` = :uniacid AND ischeck=:ischeck";
$paras = array();
$paras[':uniacid'] = $_W['uniacid'];
$paras[':ischeck'] = intval($ischeck);
$sql = "SELECT * FROM " . tablename('qiyue_canvas') . $where . ' ORDER BY createtime DESC, id DESC';
$result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize, $paras);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('qiyue_canvas') . $where, $paras);
if ($_W['isajax']) {
$context['ajaxcallback'] = 1;
$result['pager'] = pagination($total, $pindex, $psize, '', $context);
} else {
$result['pager'] = pagination($total, $pindex, $psize);
}
if (!empty($result['list'])) {
foreach ($result['list'] as &$row) {
$row['url'] = url('mobile/module/index', array('name' => 'site', 'id' => $row['id'], 'weid' => $_W['weid']));
}
}
return $result;
}