本文整理汇总了PHP中pdo_fetch函数的典型用法代码示例。如果您正苦于以下问题:PHP pdo_fetch函数的具体用法?PHP pdo_fetch怎么用?PHP pdo_fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdo_fetch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
load()->model('mc');
global $_W, $_GPC;
//要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
$creditnames = uni_setting($_W['uniacid'], array('creditnames'));
if ($creditnames) {
foreach ($creditnames['creditnames'] as $index => $creditname) {
if ($creditname['enabled'] == 0) {
unset($creditnames['creditnames'][$index]);
}
}
$scredit = implode(', ', array_keys($creditnames['creditnames']));
} else {
$scredit = '';
}
$groups = mc_groups($_W['uniacid']);
$couponlists = pdo_fetchall('SELECT couponid,title,type,credittype,credit,endtime,amount,dosage FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC ', array(':uniacid' => $_W['uniacid'], ':type' => 1, ':endtime' => TIMESTAMP));
$tokenlists = pdo_fetchall('SELECT couponid,title,type,credittype,credit,endtime,amount,dosage FROM ' . tablename('activity_coupon') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC ', array(':uniacid' => $_W['uniacid'], ':type' => 2, ':endtime' => TIMESTAMP));
$goodslists = pdo_fetchall('SELECT id,title,type,credittype,endtime,total,num,credit FROM ' . tablename('activity_exchange') . ' WHERE uniacid = :uniacid AND type = :type AND endtime > :endtime ORDER BY endtime ASC', array(':uniacid' => $_W['uniacid'], ':type' => 3, ':endtime' => TIMESTAMP));
//print_r($couponlists);
load()->func('tpl');
if ($rid == 0) {
$reply = array('title' => '幸运大抽奖活动开始了!', 'description' => '幸运大抽奖活动开始啦!', 'tips' => '每次抽奖需要花费50积分,一等奖为39元的现金抵扣券,二等奖为100积分,三等奖为50积分,四等奖为30积分。每人每天限抽2次。', 'remark' => '中奖积分请到会员主页查看', 'starttime' => time(), 'endtime' => time() + 10 * 84400, 'reg' => '0', 'status' => '1', 'awardnum' => '1', 'playnum' => '5', 'dayplaynum' => '1', 'zfcs' => '1', 'zjcs' => '1', 'rate' => '10', 'need_type' => 'credit1', 'need_num' => '0', 'give_type' => 'credit1', 'give_num' => '0', 'onlynone' => '1', 'share_title' => '欢迎参加幸运大抽奖活动', 'share_content' => '亲,欢迎参加幸运大抽奖活动,祝您好运哦!! 亲,需要绑定账号才可以参加哦');
$prizes = array('p1_type' => 'credit1');
} else {
$reply = pdo_fetch("SELECT * FROM " . tablename($this->table_reply) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
$prizes = iunserializer($reply['prizes']);
}
include $this->template('form');
}
示例3: respond
public function respond()
{
global $_W;
$content = $this->message['content'];
$foods = pdo_fetchall("SELECT * FROM " . tablename('jufeng_wcy_foods') . " WHERE weid = '{$_W['uniacid']}' AND title LIKE '%{$content}%' ");
$pcate = pdo_fetchall("SELECT * FROM " . tablename('jufeng_wcy_category') . " WHERE weid = '{$_W['uniacid']}' AND parentid = '0' AND name LIKE '%{$content}%' ");
$news[] = array('title' => '在线订餐', 'description' => '方便快捷,价格优惠', 'picurl' => '../addons/jufeng_wcy/images/dc.jpg', 'url' => $this->createMobileUrl('dianjia'));
$foodsnum = count($foods);
$pcatenum = count($pcate);
if ($foodsnum == 0 && $pcatenum == 0) {
$news[] = array('title' => '直接回复你想吃的,可搜索菜品和餐馆哦');
$news[] = array('title' => '没有关于【' . $content . '】的菜品或餐馆');
}
if ($pcatenum < 9) {
$printnum = $pcatenum;
} else {
$printnum = 9;
}
for ($i = 0; $i < $printnum; $i++) {
$news[] = array('title' => "【" . $pcate[$i]['name'] . "】——" . "热度:" . $pcate[$i]['total'], 'description' => "", 'picurl' => $_W['attachurl'] . $pcate[$i]['thumb'], 'url' => $this->createMobileUrl('list', array('pcate' => $pcate[$i]['id'])));
}
$printnum = 9 - $printnum;
if ($foodsnum < $printnum) {
$printnum = $foodsnum;
}
for ($i = 0; $i < $printnum; $i++) {
$dianjia = pdo_fetch("SELECT * FROM " . tablename('jufeng_wcy_category') . " WHERE weid = '{$_W['uniacid']}' AND id = '{$foods[$i]['pcate']}'");
$news[] = array('title' => "【" . $foods[$i]['title'] . "】——" . $dianjia['name'], 'description' => "菜品热度:" . $foods[$i]['hits'], 'picurl' => $_W['attachurl'] . $foods[$i]['thumb'], 'url' => $this->createMobileUrl('list', array('pcate' => $foods[$i]['pcate'])));
}
return $this->respNews($news);
}
示例4: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE rid = :id AND parent_id = -1 ORDER BY displayorder DESC, id ASC LIMIT 8";
$commends = pdo_fetchall($sql, array(':id' => $rid));
if (empty($commends)) {
$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE rid = :id AND parent_id = 0 ORDER BY RAND()";
$main = pdo_fetch($sql, array(':id' => $rid));
if (empty($main['id'])) {
return false;
}
$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE id = :id OR parent_id = :parent_id ORDER BY parent_id ASC, displayorder DESC, id ASC LIMIT 8";
$commends = pdo_fetchall($sql, array(':id' => $main['id'], ':parent_id' => $main['id']));
}
if (empty($commends)) {
return false;
}
$news = array();
foreach ($commends as $c) {
$row = array();
$row['title'] = $c['title'];
$row['description'] = $c['description'];
!empty($c['thumb']) && ($row['picurl'] = tomedia($c['thumb']));
$row['url'] = empty($c['url']) ? $this->createMobileUrl('detail', array('id' => $c['id'])) : $c['url'];
$news[] = $row;
}
return $this->respNews($news);
}
示例5: cron_run
function cron_run($cronid = 0)
{
if (empty($cronid)) {
$cron = pdo_fetch('SELECT * FROM ' . tablename('cron') . ' WHERE available > 0 AND nextrun <= ' . TIMESTAMP . ' ORDER BY nextrun ASC');
} else {
$cron = pdo_fetch('SELECT * FROM ' . tablename('cron') . ' WHERE cronid = :id', array(':id' => intval($cronid)));
}
if (empty($cron)) {
return false;
}
if ($cron['type'] == 'system') {
//定义系统内置的计划任务文件放在哪个路径
$cronfile = IA_ROOT . '/cron/' . $cron['filename'];
} elseif ($cron['type'] == 'module') {
//定义模块的计划任务文件放在哪个路径
$cronfile = IA_ROOT . '/cron/' . $cron['filename'];
}
if (is_file($cronfile)) {
$cron['minute'] = explode("\t", $cron['minute']);
//设置下次执行时间
cron_setnexttime($cron);
@set_time_limit(1000);
//@ignore_user_abort(TRUE);
if (!@(include $cronfile)) {
return false;
}
}
}
示例6: respond
public function respond() {
global $_W;
$rid = $this->rule;
$sql = "SELECT id FROM " . tablename('news_reply') . " WHERE `rid`=:rid AND parentid = 0 ORDER BY RAND()";
$main = pdo_fetch($sql, array(':rid' => $rid));
if (empty($main['id'])) {
return array();
}
$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE id = :id OR parentid = :parentid ORDER BY parentid ASC, id ASC LIMIT 8";
$commends = pdo_fetchall($sql, array(':id'=>$main['id'], ':parentid'=>$main['id']));
$news = array();
foreach($commends as $c) {
$row = array();
$row['title'] = $c['title'];
$row['description'] = $c['description'];
!empty($c['thumb']) && $row['picurl'] = $_W['attachurl'] . trim($c['thumb'], '/');
$row['url'] = empty($c['url']) ? $_W['siteroot'] . create_url('index/module', array('do' => 'detail', 'name' => 'news', 'id' => $c['id'])) : $c['url'];
$news[] = $row;
}
$r['FromUserName'] = $this->message['to'];
$r['ToUserName'] = $this->message['from'];
$r['MsgType'] = 'news';
$r['ArticleCount'] = count($news);
$r['Articles'] = array();
foreach ($news as $row) {
$r['Articles'][] = array(
'Title' => $row['title'],
'Description' => $row['description'],
'PicUrl' => $row['picurl'],
'Url' => $row['url'],
'TagName' => 'item',
);
}
return $r;
}
示例7: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
//要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0
global $_W;
$reply = pdo_fetch("SELECT * FROM " . tablename('game2048_reply') . " WHERE rid = :rid", array(':rid' => $rid));
include $this->template('form');
}
示例8: reply_kaquanDetail
private function reply_kaquanDetail($card_id)
{
$sql = "SELECT card_detail FROM " . tablename($this->tb_cards) . " WHERE card_id = :card_id";
$param[':card_id'] = $card_id;
$card_detail = pdo_fetch($sql, $param);
return $card_detail['card_detail'];
}
示例9: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$sql = "SELECT title,description,start_picurl,isshow,starttime,endtime,end_theme,end_instruction,end_picurl FROM " . tablename('smashegg_reply') . " WHERE `rid`=:rid LIMIT 1";
$row = pdo_fetch($sql, array(':rid' => $rid));
if ($row == false) {
return array();
}
if ($row['isshow'] == 0) {
return array();
}
if ($row['endtime'] < time()) {
if (substr($row['end_picurl'], 0, 7) == "http://") {
$picurl = $row['end_picurl'];
} else {
$picurl = $_W['siteroot'] . trim($row['end_picurl'], '/');
}
return $this->respNews(array('Title' => $row['end_theme'], 'Description' => $row['end_instruction'], 'PicUrl' => $picurl, 'Url' => $this->createMobileUrl('index', array('id' => $rid))));
} else {
if (substr($row['start_picurl'], 0, 7) == "http://") {
$picurl = $row['start_picurl'];
} else {
$picurl = $_W['siteroot'] . trim($row['start_picurl'], '/');
}
return $this->respNews(array('Title' => $row['title'], 'Description' => $row['description'], 'PicUrl' => $picurl, 'Url' => $this->createMobileUrl('index', array('id' => $rid))));
}
}
示例10: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$reply = pdo_fetch("SELECT * FROM " . tablename('vote_reply') . " WHERE `rid`=:rid LIMIT 1", array(':rid' => $rid));
if ($reply == false) {
return $this->respText('活动已经取消...');
}
$nowtime = time();
$endtime = $reply['endtime'] + 86399;
if ($reply['status'] == 0) {
return $this->respText("投票已暂停,请等待...");
}
if ($reply['votelimit'] == 1) {
if ($reply['votetotal'] > 0 && $reply['votenum'] >= $reply['votetotal']) {
return $this->respText("投票人数已满,活动结束...");
}
} else {
if ($reply['starttime'] > $nowtime) {
return $this->respText("投票未开始,请等待...");
} elseif ($endtime < $nowtime) {
return $this->respText("投票已结束...");
} else {
// if ($reply['status'] != 1) {
// return $this->respText("投票已暂停,请等待...");
// }
}
}
return $this->respNews(array('Title' => $reply['title'], 'Description' => $reply['description'], 'PicUrl' => tomedia($reply['thumb']), 'Url' => $this->createMobileUrl("index", array("id" => $rid))));
}
示例11: receive
public function receive()
{
global $_W;
$type = $this->message['type'];
//这里定义此模块进行消息订阅时的, 消息到达以后的具体处理过程, 请查看WORMWOOD文档来编写你的代码
if ($type != "text" && $type != "image" && $type != "voice") {
return;
}
$file = IA_ROOT . '/source/modules/mechat/function.php';
if (!file_exists($file)) {
return array();
}
include_once $file;
$sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
$row = pdo_fetch($sql, array(':weid' => $_W['weid']));
if ($row) {
$pdata = array("ToUserName" => $this->message['tousername'], "FromUserName" => $this->message['fromusername'], "CreateTime" => $this->message['createtime'], "MsgType" => $this->message['msgtype'], "Content" => $this->message['content'], "MsgId" => $this->message['msgid']);
if ($type == "voice") {
$pdata["MsgType"] = "text";
$pdata["Content"] = "系统:微信公众号粉丝发送语音消息,系统暂不能接收请客服处理。";
}
$dat = array('unit' => $row["name"], 'msg' => json_encode($pdata));
$dat2 = iunserializer($row["cdata"]);
$actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $dat2["access_token"], "appid" => $dat2["appid"], "appsecret" => $dat2["appsecret"]));
$url = sprintf($this->gateway['mechat_receive'], $actoken);
$content = ihttp_post($url, $dat);
}
}
示例12: receive
public function receive()
{
global $_W, $_GPC;
load()->model('mc');
load()->func('communication');
$event = $this->message['event'];
$openid = $this->message['from'];
$f_log = pdo_fetch("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE `uniacid` = '{$_W['uniacid']}' AND `openid` = '{$openid}'");
if ($f_log['uid'] != 0) {
pdo_update('hx_subscribe_data', array('uid' => $f_log['uid']), array('openid' => $openid));
$uid = $f_log['uid'];
} else {
$default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid']));
$data = array('uniacid' => $_W['uniacid'], 'email' => md5($openid) . '@qdaygroup.com', 'salt' => random(8), 'groupid' => $default_groupid, 'createtime' => TIMESTAMP);
$data['password'] = md5($message['from'] . $data['salt'] . $_W['config']['setting']['authkey']);
pdo_insert('mc_members', $data);
$uid = pdo_insertid();
pdo_update('mc_mapping_fans', array('uid' => $uid), array('openid' => $openid));
pdo_update('hx_subscribe_data', array('uid' => $uid), array('openid' => $openid));
}
$credit_type = isset($this->module['config']['credit_type']) ? $this->module['config']['credit_type'] : 'credit1';
$credit_subscribe = isset($this->module['config']['credit_subscribe']) ? $this->module['config']['credit_subscribe'] : 5;
$credit_lever_1 = isset($this->module['config']['credit_lever_1']) ? $this->module['config']['credit_lever_1'] : 2;
$credit_lever_2 = isset($this->module['config']['credit_lever_2']) ? $this->module['config']['credit_lever_2'] : 1;
if ($event == 'subscribe') {
$s_log = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `openid`='{$openid}'");
if (empty($s_log)) {
//如果没记录
$insert = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'uid' => $uid, 'from_uid' => '0', 'sn' => time(), 'follow' => '1', 'article_id' => '0', 'shouyi' => $credit_subscribe, 'createtime' => TIMESTAMP);
pdo_insert('hx_subscribe_data', $insert);
mc_credit_update($uid, $credit_type, $credit_subscribe, array('1', '关注增加积分'));
} else {
//如果有记录
if ($s_log['follow'] != 1) {
//如果记录未关注
$insert = array('follow' => '1');
pdo_update('hx_subscribe_data', $insert, array('id' => $s_log['id']));
mc_credit_update($uid, $credit_type, $credit_subscribe, array('1', '关注增加积分'));
}
if (!empty($s_log['from_uid'])) {
//如果来源ID不为空
$from_user = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$s_log['from_uid']}'");
if (!empty($from_user)) {
$data = array('shouyi' => $from_user['shouyi'] + $credit_lever_1, 'zjrs' => $from_user['zjrs'] + 1);
pdo_update('hx_subscribe_data', $data, array('id' => $from_user['id']));
mc_credit_update($s_log['from_uid'], $credit_type, $credit_lever_1, array('1', '推荐一级关注增加积分'));
if (!empty($from_user['from_uid'])) {
$from_user_2 = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$from_user['from_uid']}'");
if (!empty($from_user_2)) {
$data2 = array('shouyi' => $from_user_2['shouyi'] + $credit_lever_2, 'jjrs' => $from_user_2['jjrs'] + 1);
pdo_update('hx_subscribe_data', $data2, array('id' => $from_user_2['id']));
mc_credit_update($from_user['from_uid'], $credit_type, $credit_lever_2, array('1', '推荐二级关注增加积分'));
}
}
}
}
}
//pdo_update('hx_subscribe_data',array('follow'=>1),array('openid'=>$openid));
}
}
示例13: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0) {
global $_W;
if (!empty($rid)) {
$row = pdo_fetch("SELECT * FROM ".tablename($this->tablename)." WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
if (!strexists($row['apiurl'], 'http://') && !strexists($row['apiurl'], 'https://')) {
$row['apilocal'] = $row['apiurl'];
$row['apiurl'] = '';
}
} else {
$row = array(
'cachetime' => 0,
);
}
$path = IA_ROOT . '/source/modules/userapi/api';
if (is_dir($path)) {
$apis = array();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$apis[] = $file;
}
}
}
}
include $this->template('userapi/form');
}
示例14: 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');
}
示例15: doWebsetting
public function doWebsetting()
{
global $_W, $_GPC;
$weid = $_W['uniacid'];
load()->func('tpl');
$subject = pdo_fetch("SELECT * FROM " . tablename(hc_ybdzs_setting) . " WHERE weid = '{$weid}' ORDER BY id DESC LIMIT 1");
$item['hc_ybdzs_title'] = empty($item['hc_ybdzs_title']) ? '月饼大战' : $item['hc_ybdzs_title'];
$item['share_desc'] = empty($item['share_desc']) ? '我只用了一层功力,已经无人可及了!' : $item['share_desc'];
$item['wechat'] = empty($item['wechat']) ? '导流标题' : $item['wechat'];
$item['hc_ybdzs_url'] = empty($item['hc_ybdzs_url']) ? 'http://52jscn.com' : $item['hc_ybdzs_url'];
if (checksubmit()) {
$data = array('hc_ybdzs_title' => $_GPC['hc_ybdzs_title'], 'hc_ybdzs_url' => $_GPC['hc_ybdzs_url'], 'share_desc' => $_GPC['share_desc'], 'wechat' => $_GPC['wechat'], 'counts' => $_GPC['counts'], 'photo' => $_GPC['photo']);
if (empty($subject)) {
$data['weid'] = $weid;
pdo_insert(hc_ybdzs_setting, $data);
} else {
pdo_update(hc_ybdzs_setting, $data, array('weid' => $weid));
}
message('欧了!欧了!更新完毕!', referer(), 'success');
}
if (!$subject['photo']) {
$subject = array("photo" => "../addons/hc_ybdzs/template/mobile/b.gif");
}
include $this->template('setting');
}