本文整理汇总了PHP中pdo_insert函数的典型用法代码示例。如果您正苦于以下问题:PHP pdo_insert函数的具体用法?PHP pdo_insert怎么用?PHP pdo_insert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdo_insert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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');
}
示例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('');
}
示例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));
}
}
示例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');
}
}
示例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;
}
示例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;
}
示例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');
}
示例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, '添加记录失败');
}
}
示例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');
}
示例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');
}
示例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');
}
示例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;
}
示例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');
}
示例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');
}