sql数据提交到库问题双条数据,求高手解

weixin_38061618 2015-12-21 01:53:06
 开发四年只会写业务代码,分布式高并发都不会还做程序员?->>>    //#####################@ 订单增加 @#####################// case 'add': pe_lead('hook/order.hook.php'); $cache_payway = cache::get('payway'); $cart_list = cart_list(unserialize($_c_cart_list)); $info_list = $cart_list['list']; $money = $cart_list['money']; //调用用户个人信息里的收货地址 $info = $db->pe_select('user', array('user_id'=>$_s_user_id)); $info['user_point'] = $info['user_point'] ? $info['user_point'] : 0; $user_point_money = $cache_setting['point_money'] ? round($info['user_point']/$cache_setting['point_money'], 1) : 0; user_quancheck(); $quan_list = user_quanlist(); if (isset($_p_pesubmit)) { $order_quan_id = intval($_p_order_quan_id); $order_point_use = intval($_p_order_point_use); if (!$cache_setting['web_guestbuy'] && !pe_login('user')) pe_error('请先登录...', "{$pe['host_root']}user.php?mod=do&act=login");   !count($info_list) && pe_error('购物车商品为空...'); !$_p_order_payway && pe_error('请选择付款方式...'); if ($order_quan_id && !$quan_list[$order_quan_id]['quan_id']) pe_error('优惠券无效...'); if ($order_point_use > $info['user_point']) pe_error('账户积分不足...'); //$order = $db->pe_select('order', array('order by'=>'order_id desc')); //substr($order['order_id'], 0 , 6) != date('ymd') && $sql_order['order_id'] = $order_id = date('ymd').'0001'; $sql_order['order_id'] = $order_id = order_setid(); $sql_order['order_product_money'] = $money['order_product_money']; $sql_order['order_wl_money'] = $money['order_wl_money']; $sql_order['order_money'] = $money['order_money']; $sql_order['order_point_get'] = $money['order_point_get']; $sql_order['order_atime'] = time(); $sql_order['order_payway'] = $_p_order_payway; $sql_order['order_text'] = $_p_order_text; $sql_order['user_id'] = $_s_user_id; $sql_order['user_name'] = $_s_user_name; $sql_order['user_address'] = "{$_p_province}{$_p_city}{$_p_user_address}"; $sql_order['user_tname'] = $_p_user_tname; $sql_order['user_phone'] = $_p_user_phone; if ($order_quan_id) { $sql_order['order_quan_id'] = $order_quan_id; $sql_order['order_quan_name'] = $quan_list[$order_quan_id]['quan_name']; $sql_order['order_quan_money'] = $quan_list[$order_quan_id]['quan_money']; } if ($order_point_use) { $sql_order['order_point_use'] = $order_point_use; $sql_order['order_point_money'] = $cache_setting['point_money'] ? round($order_point_use/$cache_setting['point_money'], 1) : 0; } $sql_order['order_money'] = $sql_order['order_money'] - $sql_order['order_quan_money'] - $sql_order['order_point_money']; if ($sql_order['order_money'] < 0) $sql_order['order_money'] = 0; if ($db->pe_insert('order', pe_dbhold($sql_order))) { foreach ($info_list as $v) { $sql_orderdata['product_id'] = $v['product_id']; $sql_orderdata['product_name'] = $v['product_name']; $sql_orderdata['product_logo'] = $v['product_logo']; $sql_orderdata['product_money'] = $v['product_money']; $sql_orderdata['product_num'] = $v['product_num']; $sql_orderdata['prorule_key'] = $v['prorule_key']; $sql_orderdata['prorule_name'] = $v['prorule_name']; $sql_orderdata['order_id'] = $order_id; $db->pe_insert('orderdata', pe_dbhold($sql_orderdata, array('prorule_name'))); $sql_order['product_id'] = $v['product_id']; $sql_order['product_name'] = $v['product_name']; $sql_order['product_logo'] = $v['product_logo']; $sql_order['product_money'] = $v['product_money']; $sql_order['product_num'] = $v['product_num']; $sql_order['prorule_key'] = $v['prorule_key']; $sql_order['prorule_name'] = $v['prorule_name']; $sql_order['order_id'] = $order_id; $db->pe_insert('order', pe_dbhold($sql_order, array('prorule_name'))); } order_callback('add', $order_id); pe_success('订单提交成功!', "{$pe['host_root']}index.php?mod=order&act=pay&id={$order_id}"); } else { pe_error('订单提交失败...'); } } $seo = pe_seo('填写收货信息'); include(pe_tpl('order_add.html')); break; 数据库 我需要的是第二条数据,求高手帮我看一下 哪里错了,万分感谢 if ($db->pe_insert('order', pe_dbhold($sql_order))) { 我要是删掉了就无法提交商品到购物车。 $sql_order['product_id'] = $v['product_id']; $sql_order['product_name'] = $v['product_name']; $sql_order['product_logo'] = $v['product_logo']; $sql_order['product_money'] = $v['product_money']; $sql_order['product_num'] = $v['product_num']; $sql_order['prorule_key'] = $v['prorule_key']; $sql_order['prorule_name'] = $v['prorule_name']; 我需要数据以上也添加到order库 $db->pe_insert('order', pe_dbhold($sql_order, array('prorule_name')));添加这个就造成双条数据了,没有这个就添加不成功,不知道怎么修改了,求高手指点
...全文
25 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

476

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧