• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pdo_insert函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中pdo_insert函数的典型用法代码示例。如果您正苦于以下问题:PHP pdo_insert函数的具体用法?PHP pdo_insert怎么用?PHP pdo_insert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: fieldsFormSubmit

 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'description' => $_GPC['description'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'bgimg' => $_GPC['bgimg'], 'shareimg' => $_GPC['shareimg'], 'titleimg' => $_GPC['titleimg'], 'helpimg' => $_GPC['helpimg'], 'cameraimg' => $_GPC['cameraimg'], 'numberimg' => $_GPC['numberimg'], "follow_url" => $_GPC['follow_url'], "share_url" => $_GPC['share_url'], "share_title" => $_GPC['share_title'], "share_icon" => $_GPC['share_icon'], "share_desc" => $_GPC['share_desc']);
     //物品
     $item_ids = $_GPC['item_id'];
     $items = array();
     if (is_array($item_ids)) {
         foreach ($item_ids as $key => $value) {
             $d = array("id" => $value, "score" => $_GPC['item_score_' . $value], "rate" => $_GPC['item_rate_' . $value], "name" => $_GPC['item_name_' . $value], "thumb" => $_GPC['item_thumb_' . $value]);
             $items[] = $d;
         }
     }
     $insert['items'] = serialize($items);
     if (empty($id)) {
         $insert['createtime'] = time();
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         $id = pdo_insert('ewei_takephotoa_reply', $insert);
     } else {
         pdo_update('ewei_takephotoa_reply', $insert, array('id' => $id));
     }
     return true;
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:28,代码来源:module.php


示例2: doMobileDetail

 public function doMobileDetail()
 {
     global $_W, $_GPC;
     checkauth();
     $rid = intval($_GPC['rid']);
     $reply = pdo_fetch("SELECT * FROM " . tablename('shake_reply') . " WHERE rid = :rid", array(':rid' => $rid));
     if (empty($reply)) {
         message('抱歉,此活动不存在或是还未开始!', 'refresh', 'error');
     }
     $member = pdo_fetch("SELECT * FROM " . tablename('shake_member') . " WHERE rid = :rid AND openid = :openid", array(':rid' => $reply['rid'], ':openid' => $_W['member']['uid']));
     if (empty($member)) {
         $member = array('rid' => $rid, 'openid' => $_W['member']['uid'], 'createtime' => TIMESTAMP, 'shakecount' => 0, 'status' => 0);
         $maxjoin = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('shake_member') . " WHERE rid = '{$reply['rid']}' AND status = '1'");
         if ($maxjoin < $reply['maxjoin']) {
             mt_srand((double) microtime() * 1000000);
             $rand = mt_rand(1, 100);
             if ($rand <= $reply['joinprobability']) {
                 $member['status'] = 1;
             }
         }
         pdo_insert('shake_member', $member);
     }
     if (strexists(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) {
         $reply['speed'] = $reply['speedandroid'];
     }
     include $this->template('detail');
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:27,代码来源:site.php


示例3: respond

 public function respond()
 {
     global $_W;
     $msgtype = $this->message['type'];
     $allow = array('text', 'image', 'location', 'link', 'trace');
     if (!in_array($msgtype, $allow)) {
         return $this->respText('抱歉,系统仅支持 文字,图片,地理位置,链接类型的消息!');
     }
     $close = 0;
     if ($msgtype == 'text') {
         $content = $this->message['content'];
         if ($content == '关闭') {
             $content = '<span class="text-danger">系统消息:粉丝关闭了对话</span>';
             $close = 1;
         }
     } elseif ($msgtype == 'image') {
         $content = $this->message['picurl'];
     } elseif ($msgtype == 'location') {
         $content = iserializer(array('location_x' => $this->message['location_x'], 'location_y' => $this->message['location_y'], 'scale' => $this->message['scale']));
     } elseif ($msgtype == 'link') {
         $content = $this->message['url'];
     }
     if (!empty($content)) {
         $insert = array('uniacid' => $_W['uniacid'], 'acid' => $_W['acid'], 'openid' => $_W['openid'], 'msgtype' => $msgtype, 'flag' => 2, 'content' => $content, 'createtime' => TIMESTAMP);
         pdo_insert('mc_chats_record', $insert);
     }
     $this->refreshContext(300);
     if ($close == 1) {
         $this->endContext();
         return $this->respText('您成功关闭回话。');
     }
     return $this->respText('');
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:33,代码来源:processor.php


示例4: fieldsFormSubmit

 public function fieldsFormSubmit($rid)
 {
     //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
     global $_W, $_GPC;
     load()->func('file');
     $id = intval($_GPC['reply_id']);
     $insert = array("rid" => $rid, "weid" => $_W['uniacid'], "title" => $_GPC['title'], "description" => $_GPC['description'], "rule" => trim($_GPC['rule']), "end_title" => $_GPC['end_title'], "end_description" => $_GPC['end_description'], "starttime" => strtotime($_GPC['datelimit']['start']), "endtime" => strtotime($_GPC['datelimit']['end']), "total_times" => $_GPC['total_times'], "totaldayplay_times" => $_GPC['totaldayplay_times'], "totaldayshare_times" => $_GPC['totaldayshare_times'], "sharelottery_times" => $_GPC['sharelottery_times'], "gametime" => $_GPC['gametime'], "showusernum" => $_GPC['showusernum'], "share_title" => $_GPC['share_title'], "share_desc" => $_GPC['share_desc'], "share_url" => $_GPC['share_url'], "follow_url" => $_GPC['follow_url'], "gameovertext" => $_GPC['gameovertext'], "tips1text" => $_GPC['tips1text'], "tips2text" => $_GPC['tips2text'], "tips3text" => $_GPC['tips3text'], "signtext" => $_GPC['signtext'], "isneedfollow" => $_GPC['isneedfollow'], "awardtip" => $_GPC['awardtip'], "copyright" => $_GPC['copyright']);
     if (!empty($_GPC['start_picurl'])) {
         $insert['picture'] = $_GPC['start_picurl'];
     }
     if (!empty($_GPC['end_picurl'])) {
         $insert['end_picurl'] = $_GPC['end_picurl'];
     }
     if (!empty($_GPC['share_image'])) {
         $insert['share_image'] = $_GPC['share_image'];
     }
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         pdo_insert($this->table_reply, $insert);
     } else {
         pdo_update($this->table_reply, $insert, array('id' => $id));
     }
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:27,代码来源:module.php


示例5: doMobilePay

 public function doMobilePay()
 {
     global $_W, $_GPC;
     if (empty($_W['member']['uid'])) {
         checkauth();
     }
     $username = $_W['member']['email'] ? $_W['member']['email'] : $_W['member']['mobile'];
     if (empty($username)) {
         message('您的用户信息不完整,请完善用户信息后再充值', '', 'error');
     }
     if (checksubmit('submit', true) || !empty($_GPC['ajax'])) {
         $fee = floatval($_GPC['money']);
         if ($fee <= 0) {
             message('支付错误, 金额小于0');
         }
         $chargerecord = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE uniacid = :uniacid AND uid = :uid AND fee = :fee AND status = '0'", array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':fee' => $fee));
         if (empty($chargerecord)) {
             $chargerecord = array('uid' => $_W['member']['uid'], 'uniacid' => $_W['uniacid'], 'tid' => date('YmdHi') . random(10, 1), 'fee' => $fee, 'status' => 0, 'createtime' => TIMESTAMP);
             if (!pdo_insert('mc_credits_recharge', $chargerecord)) {
                 message('创建充值订单失败,请重试!', url('entry', array('m' => 'recharge', 'do' => 'pay')), 'error');
             }
         }
         $params = array('tid' => $chargerecord['tid'], 'ordersn' => $chargerecord['tid'], 'title' => '系统充值余额', 'fee' => $chargerecord['fee'], 'user' => $_W['member']['uid']);
         $this->pay($params);
     } else {
         include $this->template('recharge');
     }
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:28,代码来源:site.php


示例6: fieldsFormSubmit

 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     if (!empty($_GPC['music-title'])) {
         foreach ($_GPC['music-title'] as $index => $title) {
             if (empty($title)) {
                 continue;
             }
             $update = array('title' => $title, 'description' => $_GPC['music-description'][$index], 'url' => $_GPC['music-url'][$index], 'hqurl' => $_GPC['music-hqurl'][$index]);
             if (!empty($_GPC['music-url-old'][$index]) && $_GPC['music-url'][$index] != $_GPC['music-url-old'][$index]) {
                 file_delete($_GPC['music-url-old'][$index]);
             }
             pdo_update($this->tablename, $update, array('id' => $index));
         }
     }
     //处理添加
     if (!empty($_GPC['music-title-new'])) {
         foreach ($_GPC['music-title-new'] as $index => $title) {
             if (empty($title)) {
                 continue;
             }
             $insert = array('rid' => $rid, 'title' => $title, 'description' => $_GPC['music-description-new'][$index], 'url' => $_GPC['music-url-new'][$index], 'hqurl' => $_GPC['music-hqurl-new'][$index]);
             pdo_insert($this->tablename, $insert);
         }
     }
     return true;
 }
开发者ID:yunsite,项目名称:my-we7,代码行数:27,代码来源:module.php


示例7: fieldsFormSubmit

 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $_W['weid'], 'title' => $_GPC['title'], 'content' => $_GPC['content'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'repeat_lottery_reply' => $_GPC['repeat_lottery_reply'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'probability' => $_GPC['probability'], 'c_type_one' => $_GPC['c_type_one'], 'c_name_one' => $_GPC['c_name_one'], 'c_num_one' => $_GPC['c_num_one'], 'c_type_two' => $_GPC['c_type_two'], 'c_name_two' => $_GPC['c_name_two'], 'c_num_two' => $_GPC['c_num_two'], 'c_type_three' => $_GPC['c_type_three'], 'c_name_three' => $_GPC['c_name_three'], 'c_num_three' => $_GPC['c_num_three'], 'c_type_four' => $_GPC['c_type_four'], 'c_name_four' => $_GPC['c_name_four'], 'c_num_four' => $_GPC['c_num_four'], 'c_type_five' => $_GPC['c_type_five'], 'c_name_five' => $_GPC['c_name_five'], 'c_num_five' => $_GPC['c_num_five'], 'c_type_six' => $_GPC['c_type_six'], 'c_name_six' => $_GPC['c_name_six'], 'c_num_six' => $_GPC['c_num_six'], 'award_times' => $_GPC['award_times'], 'number_times' => $_GPC['number_times'], 'most_num_times' => $_GPC['most_num_times'], 'sn_code' => $_GPC['sn_code'], 'sn_rename' => $_GPC['sn_rename'], 'tel_rename' => $_GPC['tel_rename'], 'show_num' => $_GPC['show_num'], 'createtime' => time(), 'copyright' => $_GPC['copyright'], 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'share_txt' => $_GPC['share_txt'], 'starttime' => strtotime($_GPC['datelimit-start']), 'endtime' => strtotime($_GPC['datelimit-end']), 'c_rate_one' => $_GPC['c_rate_one'], 'c_rate_two' => $_GPC['c_rate_two'], 'c_rate_three' => $_GPC['c_rate_three'], 'c_rate_four' => $_GPC['c_rate_four'], 'c_rate_five' => $_GPC['c_rate_five'], 'c_rate_six' => $_GPC['c_rate_six']);
     if (!empty($_GPC['start_picurl'])) {
         $insert['start_picurl'] = $_GPC['start_picurl'];
         file_delete($_GPC['start_picurl-old']);
     }
     if (!empty($_GPC['end_picurl'])) {
         $insert['end_picurl'] = $_GPC['end_picurl'];
         file_delete($_GPC['end_picurl-old']);
     }
     $insert['total_num'] = intval($_GPC['c_num_one']) + intval($_GPC['c_num_two']) + intval($_GPC['c_num_three']) + intval($_GPC['c_num_four']) + intval($_GPC['c_num_five']) + intval($_GPC['c_num_six']);
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         $id = pdo_insert($this->tablename, $insert);
     } else {
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
     return true;
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:26,代码来源:module.php


示例8: doWebAwardSet

 public function doWebAwardSet()
 {
     global $_GPC, $_W;
     checklogin();
     $id = intval($_GPC['id']);
     $weid = $_W['weid'];
     $from_user = $_W['fans']['from_user'];
     $row = pdo_fetchall("SELECT award FROM " . tablename('mgamblemoon_award_set') . " WHERE weid={$weid} AND awardid in (0,1,2,3,4,5,6,7,8)");
     //print_r($row);
     $names = array('状元插金花', '五红', '五子', '普通状元', '对堂', '四进', '三红', '二举', '一秀');
     if ($_W['ispost']) {
         $award = $_GPC['award'];
         print_r($award);
         foreach ($names as $key => $name) {
             $insert = array('weid' => $weid, 'awardname' => $name, 'awardid' => $key, 'award' => $_GPC[$name], 'createtime' => TIMESTAMP);
             $is = pdo_fetch("SELECT * FROM " . tablename('mgamblemoon_award_set') . "WHERE awardid='{$key}' AND weid = {$weid}");
             if (empty($is)) {
                 pdo_insert('mgamblemoon_award_set', $insert);
             } else {
                 pdo_update('mgamblemoon_award_set', $insert, array('id' => $is['id']));
             }
         }
         $url = $this->createWebUrl('awardset', array('id' => $id));
         message('保存数据成功', $url, success);
     }
     include $this->template('awardset');
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:27,代码来源:site.php


示例9: rule_insert_keyword

function rule_insert_keyword($data) {
	if (!isset($data['rid']) || !isset($data['content'])) {
		return error(1, '参数不完整');
	}
	if (isset($data['id'])) {
		$updateid = $data['id'];
	}
	//正则表达式需要验证其合法性
	if ($data['type'] == 3) {
					
	}
	$insert = array(
		'content' => $data['content'],
		'type' => $data['type'],
		'rid' => $data['rid'],
		'weid' => $data['weid'],
		
	);
	!empty($data['module']) && $insert['module'] = $data['module'];
	if (!empty($updateid) && $updateid > 0) {
		$result = pdo_update('rule_keyword', $insert, array('id' => $updateid));
	} else {
		$result = pdo_insert('rule_keyword', $insert);
	}
	if ($result) {
		return true;	
	} else {
		return error(1, '添加记录失败');
	}
}
开发者ID:royalwang,项目名称:saivi,代码行数:30,代码来源:rule.mod.php


示例10: doWebRouteradd

 public function doWebRouteradd()
 {
     global $_GPC, $_W;
     $id = $_GPC['id'];
     $weid = $_W['weid'];
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->routertable) . " WHERE weid=:weid and id=:id", array(':weid' => $weid, ':id' => $id));
         if (empty($item)) {
             message('抱歉,您编辑的路由器信息不存在或已删除');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['rname'])) {
             message('请输入路由器名称!');
         }
         $data = array('rname' => $_GPC['rname'], 'weid' => $_W['weid'], 'iurl' => $_GPC['iurl'], 'appid' => $_GPC['appid'], 'appkey' => $_GPC['appkey'], 'nodeid' => $_GPC['nodeid'], 'status' => $_GPC['status']);
         if (empty($id)) {
             pdo_insert($this->routertable, $data);
         } else {
             pdo_update($this->routertable, $data, array('id' => $id));
         }
         message('路由器信息更新成功!', $this->createWebUrl('routerlist'), 'success');
     }
     include $this->template('routeradd');
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:25,代码来源:site.php


示例11: doWebPost

 public function doWebPost()
 {
     //这个操作被定义用来呈现 管理中心导航菜单
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->table_stores) . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,位置不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入位置名称!');
         }
         $data = array('uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'content' => htmlspecialchars_decode($_GPC['content']), 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'province' => $_GPC['reside']['province'], 'city' => $_GPC['reside']['city'], 'dist' => $_GPC['reside']['district'], 'address' => $_GPC['address'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'icon' => $_GPC['icon'], 'industry1' => $_GPC['industry_1'], 'industry2' => $_GPC['industry_2'], 'createtime' => TIMESTAMP);
         if (empty($id)) {
             pdo_insert($this->table_stores, $data);
         } else {
             unset($data['createtime']);
             pdo_update($this->table_stores, $data, array('id' => $id));
         }
         message('位置信息更新成功!', $this->createWebUrl('list'), 'success');
     }
     load()->func('tpl');
     include $this->template('post');
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:27,代码来源:site.php


示例12: doMobileIndex

 public function doMobileIndex()
 {
     global $_W, $_GPC;
     checkauth();
     $fromuser = fans_require($_W['fans']['from_user'], array('nickname', 'mobile'), '需要完善资料后才能玩.');
     $rid = $_GPC['rid'];
     $follow = fans_search($_W['fans']['from_user'], array('follow'));
     if ($follow['follow'] == 1) {
         if (intval($_GPC['id'])) {
             $score = pdo_fetchcolumn("select score from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='" . $fromuser['from_user'] . "'");
             if ($score < $_GPC['score']) {
                 $update = array('score' => $_GPC['score'], 'realname' => $fromuser['nickname']);
                 $score = $_GPC['score'];
                 pdo_update('bj_tgame_user', $update, array('id' => $_GPC['id'], 'weid' => $_W['weid']));
             }
             message($score, '', 'ajax');
         }
         $from_user = pdo_fetch("select id from_user, rid from" . tablename('bj_tgame_user') . "where from_user ='" . $fromuser['from_user'] . "'");
         if (empty($from_user['from_user'])) {
             $insert = array('id' => $_GPC['id'], 'weid' => $_W['weid'], 'rid' => $rid, 'from_user' => $fromuser['from_user'], 'realname' => $fromuser['nickname'], 'score' => 0);
             pdo_insert('bj_tgame_user', $insert);
         }
         //$from_user = pdo_fetch("select id, rid from".tablename('bj_tgame_user')."where from_user ='".$fromuser['from_user']. "'");
         if ($from_user['rid'] != $rid) {
             $update = array('rid' => $rid);
             pdo_update('bj_tgame_user', $update, array('id' => $from_user['id']));
         }
         $realname = $fromuser['nickname'];
         $user = pdo_fetch("select * from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='" . $fromuser['from_user'] . "'");
     }
     $set = pdo_fetch("select * from" . tablename('bj_tgame_reply') . "where rid =" . $rid);
     include $this->template('index');
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:33,代码来源:site.php


示例13: logCredit

 public function logCredit($_fans, $weid, $from_user, $credittype, $delta, $tag)
 {
     $fans = $_fans->get($weid, $from_user);
     $data = array('weid' => $weid, 'from_user' => $fans['from_user'], 'nickname' => $fans['nickname'], 'credit' => $fans['credit' . $credittype], 'delta' => $delta, 'tag' => $this->getCreditTypeName($credittype) . '-' . $tag, 'createtime' => TIMESTAMP);
     $ret = pdo_insert(self::$t_credit_log, $data);
     return $ret;
 }
开发者ID:aspnmy,项目名称:weizan,代码行数:7,代码来源:creditlog.class.inc.php


示例14: doWebRouteradd

 public function doWebRouteradd()
 {
     global $_GPC, $_W;
     $id = $_GPC['id'];
     $weid = $_W['uniacid'];
     //drop list
     $seldata = array('api_id' => $this->module['config']['appid'], 'api_key' => $this->module['config']['appkey']);
     $arrdat = $this->jkvisit('QRYL', $seldata);
     $clist = $arrdat['node_list'];
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->routertable) . " WHERE weid=:weid and id=:id", array(':weid' => $weid, ':id' => $id));
         if (empty($item)) {
             message('抱歉,您编辑的路由器信息不存在或已删除');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['rname'])) {
             message('请输入路由器名称!');
         }
         $data = array('rname' => $_GPC['rname'], 'weid' => $weid, 'appid' => $this->module['config']['authid'], 'appkey' => $this->module['config']['authkey'], 'iurl' => $_GPC['iurl'], 'nodeid' => $_GPC['nodeid'], 'status' => $_GPC['status']);
         if (empty($id)) {
             pdo_insert($this->routertable, $data);
         } else {
             pdo_update($this->routertable, $data, array('id' => $id));
         }
         message('路由器信息更新成功!', $this->createWebUrl('routerlist'), 'success');
     }
     load()->func('tpl');
     include $this->template('routeradd');
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:30,代码来源:site.php


示例15: 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');
 }
开发者ID:alextiannus,项目名称:wormwood_wechat,代码行数:27,代码来源:site.php


示例16: 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));
     }
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:60,代码来源:receiver.php


示例17: site_cover

/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
function site_cover($coverparams = array())
{
    $where = '';
    $params = array(':uniacid' => $coverparams['uniacid'], ':module' => $coverparams['module']);
    if (!empty($coverparams['multiid'])) {
        $where .= " AND multiid = :multiid";
        $params[':multiid'] = $coverparams['multiid'];
    }
    $cover = pdo_fetch("SELECT * FROM " . tablename('cover_reply') . " WHERE `module` = :module AND uniacid = :uniacid {$where}", $params);
    if (empty($cover['rid'])) {
        $rule = array('uniacid' => $coverparams['uniacid'], 'name' => $coverparams['title'], 'module' => 'cover', 'status' => 1);
        pdo_insert('rule', $rule);
        $rid = pdo_insertid();
    } else {
        $rule = array('name' => $coverparams['title']);
        pdo_update('rule', $rule, array('id' => $cover['rid']));
        $rid = $cover['rid'];
    }
    if (!empty($rid)) {
        $sql = 'DELETE FROM ' . tablename('rule_keyword') . ' WHERE `rid`=:rid AND `uniacid`=:uniacid';
        $pars = array();
        $pars[':rid'] = $rid;
        $pars[':uniacid'] = $coverparams['uniacid'];
        pdo_query($sql, $pars);
        $keywordrow = array('rid' => $rid, 'uniacid' => $coverparams['uniacid'], 'module' => 'cover', 'status' => 1, 'displayorder' => 0, 'type' => 1, 'content' => $coverparams['keyword']);
        pdo_insert('rule_keyword', $keywordrow);
    }
    $entry = array('uniacid' => $coverparams['uniacid'], 'multiid' => $coverparams['multiid'], 'rid' => $rid, 'title' => $coverparams['title'], 'description' => $coverparams['description'], 'thumb' => $coverparams['thumb'], 'url' => $coverparams['url'], 'do' => '', 'module' => $coverparams['module']);
    if (empty($cover['id'])) {
        pdo_insert('cover_reply', $entry);
    } else {
        pdo_update('cover_reply', $entry, array('id' => $cover['id']));
    }
    return true;
}
开发者ID:zhang19960118,项目名称:html11,代码行数:39,代码来源:site.mod.php


示例18: user_register

function user_register($user)
{
    if (empty($user) || !is_array($user)) {
        return 0;
    }
    if (isset($user['uid'])) {
        unset($user['uid']);
    }
    $user['salt'] = random(8);
    $user['password'] = user_hash($user['password'], $user['salt']);
    $user['joinip'] = CLIENT_IP;
    $user['joindate'] = TIMESTAMP;
    $user['lastip'] = CLIENT_IP;
    $user['lastvisit'] = TIMESTAMP;
    if (empty($user['status'])) {
        $user['status'] = 2;
    }
    $now = time();
    if (empty($user['endtime'])) {
        $user['endtime'] = $now + 7 * 24 * 3600;
    }
    $result = pdo_insert('users', $user);
    if (!empty($result)) {
        $user['uid'] = pdo_insertid();
    }
    return intval($user['uid']);
}
开发者ID:wisemyth,项目名称:weizan,代码行数:27,代码来源:user.mod.php


示例19: doWebPost

 public function doWebPost()
 {
     global $_GPC, $_W;
     if (empty($_GPC['do'])) {
         $_GPC['do'] = 'post';
     }
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename('business') . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,商户不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入商户名称!');
         }
         $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'content' => htmlspecialchars_decode($_GPC['content']), 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'province' => $_GPC['district']['province'], 'city' => $_GPC['district']['city'], 'dist' => $_GPC['district']['district'], 'address' => $_GPC['address'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'industry1' => $_GPC['industry']['parent'], 'industry2' => $_GPC['industry']['child'], 'createtime' => TIMESTAMP);
         if (!empty($_GPC['thumb'])) {
             $data['thumb'] = $_GPC['thumb'];
             load()->func('file');
             file_delete($_GPC['thumb-old']);
         }
         if (empty($id)) {
             pdo_insert('business', $data);
         } else {
             unset($data['createtime']);
             pdo_update('business', $data, array('id' => $id));
         }
         message('商户信息更新成功!', $this->createWebUrl('display'), 'success');
     }
     include $this->template('post');
 }
开发者ID:6662680,项目名称:qday_wx,代码行数:33,代码来源:site.php


示例20: 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');
 }
开发者ID:eduNeusoft,项目名称:weixin,代码行数:25,代码来源:site.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pdo_insert_id函数代码示例发布时间:2022-05-15
下一篇:
PHP pdo_get函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap