已有40人关注
老师好,我把有关收银台模块的五个页面压缩,给您上传过去
发表在PHP图书答疑 2016-09-04
是否精华
版块置顶:
老师好,我把有关收银台模块的五个页面压缩,给您上传过去


settle_chk.php页面修改以后:

<?php
include_once 'conn/conn.php';
$sql = "select * from tb_form where id = -1";
$rst = $conn->execute($sql);
$addform = array();
$addform['vendee'] =isset( $_POST['uid'])?$_POST['uid']:'';
$addform['commo_id'] = isset($_POST['fst'])?$_POST['fst']:'';
$addform['commo_num'] =isset( $_POST['snd'])?$_POST['snd']:'';
$addform['formid'] = time();
$tmpid = explode(',',$addform['commo_id']);
$tmpnm = explode(',',$addform['commo_num']);
$number = count($tmpid);
if($number >1){
$tmpna = array();
$tmpvp = array();
$tmpfd = array();
$tmptt = 0;
for($i = 0; $i < $number; $i++){

$tmpsql = "select name,v_price,fold from tb_commo where id = ".$tmpid[$i];
$tmprst = $conn->execute($tmpsql);
$tmpna[$i] = $tmprst->fields['name'];
$tmpvp[$i] = $tmprst->fields['v_price'];
$tmpfd[$i] = $tmprst->fields['fold'];
$tmptt += $tmprst->fields['v_price'] * $tmpnm[$i];
$tmpsell = $tmprst->fields['sell'] + 1;
$addsql = "update tb_commo set sell = ".$tmpsell." where id = ".$tmpid[$i];
$addrst = $conn->execute($addsql);
}
$addform['commo_name'] = implode(',',$tmpna);
$addform['agoprice'] = implode(',',$tmpvp);
$addform['fold'] = implode(',',$tmpfd);
$addform['total'] = $tmptt; 
}else if($number == 1){
$tmpsql = "select name,v_price,fold from tb_commo where id = ".$tmpid[0];
$tmprst = $conn->execute($tmpsql);

$addform['commo_name'] = isset($tmprst->fields['name'])?$tmprst->fields['name']:'';
$addform['agoprice'] =isset( $tmprst->fields['v_price'])?$tmprst->fields['v_price']:'';
$addform['fold'] =isset( $tmprst->fields['fold'])?$tmprst->fields['fold']:'';
$addform['total'] =isset( $tmprst->fields['v_price'])?$tmprst->fields['v_price'] * $tmpnm[0]:''; 
$tmpsell =isset( $tmprst->fields['sell'])?$tmprst->fields['sell']+1:'';
$addsql = "update tb_commo set sell = ".$tmpsell." where id = ".$tmpid[0];
$addrst = $conn->execute($addsql);
}else{
echo 'error';
exit();
}
$addform['taker'] =isset( $_POST['taker'])?$_POST['taker']:'';
$addform['code'] = isset($_POST['code'])?$_POST['code']:'';
$addform['tel'] = isset($_POST['tel'])?$_POST['tel']:'';
$addform['address'] =isset( $_POST['address'])?$_POST['address']:'';
$addform['del_method'] =isset( $_POST['del'])?$_POST['del']:'';
$addform['pay_method'] =isset( $_POST['pay'])?$_POST['pay']:'';
$addform['state']  = '0';

$InsertSQL = $conn->GetInsertSQL($rst,$addform);
if(false == $conn->execute($InsertSQL)){
echo "<script>alert('购买失败');history.back;</script>";
}else{
$updsql = "select * from tb_user where name = '".$_POST['uid']."'";
$updrst = $conn->execute($updsql);
$arr = array();
$arr['consume'] = $addform['total'];
$arr['shopping'] = '';
$UpdateSQL = $conn->GetUpdateSQL($updrst,$arr);
$conn->execute($UpdateSQL);
$fid = $conn->Insert_ID();
echo "<script>top.opener.location.reload();</script>";
echo "<script>open('forminfo.php?fid=$fid','_blank','width=600 height=450',false);window.close();</script>";
}
?>
         

预览时提示这一行(61行)代码错误$updsql = "select * from tb_user where name = '".$_POST['uid']."'";

请下载附件
分享到:
精彩评论 1
铁游夏
学分:0 LV1
TA的每日心情
还糊涂
2020-10-22 13:46:07
2016-09-07
沙发
请问一下你对书中的原来的PHP代码有没有进行修改,只上传这几个页面很难看出错误,你把完整项目打包传上来看一下。
首页上一页 1 下一页尾页 1 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照