1,跳转页面的设计
代码:<?php
"><?php echo $row["title"]?>
2,购物车页面展示
新建goodsshow.php文件<?php
header("Content-type:text/html;charset=utf-8");
include "mysqli.php";
?>
$id=isset($_GET["id"])?$_GET["id"]:1;
$sql="update goods set hits=hits+1 where id=".$id;
$mysqli->query($sql);
$sql="select *from goods where id=".$id;
$result=$mysqli->query($sql);
while($row=$result->fetch_assoc()){
?>
" width="200">
数量:-+
价格:
市场价:<?php echo $row["marketprice"] ?>
出售价:<?php echo $row["salesprice"] ?>
">
内容:<?php echo $row["content"] ?>
立刻购买 加入购物车
}
?>
因为购物网站基本都会对用户点击了哪件商品进行一个点击次数的统计,这里每次点击的时候我们也对hits字段进行了加一的操作
$sql="update goods set hits=hits+1 where id=".$id;
3,效果展示如下: