首页上一页 1 下一页尾页 1 条记录 1/1页
老师好,我把有关收银台模块的五个页面压缩,给您上传过去
发表在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']."'";
请下载附件
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']."'";
请下载附件