2 Star 4 Fork 0

Belong / shopPHP

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
myshopcar.php 1.34 KB
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
Belong 提交于 2021-07-11 09:49 . php
<?php
//不需要包含require("system/system.inc.php"),因为index.php已经包含了
$select="select id,shopping from tb_user where name='".$_SESSION['member']."'";
$rst=$admindb->ExecSQL($select,$conn);
//24,1@23,1@21,1@20,1
if($rst[0]['shopping']==""){
echo "<script>alert('购物车中暂时没有商品');window.location.href='index.php';</script>";
}
$commarr=array();
foreach($rst[0] as $value){
$tmpnum=explode('@',$value);
//$tmpnum=array((24,1),(23,1),(21,1),(20,1))
$shopnum=count($tmpnum); //商品类数
$sum=0;
foreach($tmpnum as $key => $v1){
$s_commo=explode(',',$v1);
$sql2="select id,name,pics,m_price,fold,v_price from tb_commo";
$commsql=$sql2." where id=".$s_commo[0];
/*
select id,name,m_price,fold,v_price from tb_commo where id=2
select id,name,m_price,fold,v_price from tb_commo where id=24
select id,name,m_price,fold,v_price from tb_commo where id=23
select id,name,m_price,fold,v_price from tb_commo where id=21
select id,name,m_price,fold,v_price from tb_commo where id=20
*/
$arr=$admindb->ExecSQL($commsql,$conn);
//????
$arr[0]['num']=$s_commo[1];
$arr[0]['total']=$s_commo[1]*$arr[0]['v_price'];
$sum+=$arr[0]['total'];
$commarr[$key]=$arr[0];
}
}
$smarty->assign('shoparr',$shopnum);
$smarty->assign('commarr',$commarr);
$smarty->assign('sum',$sum);
?>
1
https://gitee.com/Belong123/shop-php.git
git@gitee.com:Belong123/shop-php.git
Belong123
shop-php
shopPHP
master

搜索帮助