View product at...LOGIN

View product attributes function

1, Jump page design

微信图片_20180308150601.png

##Code:

<?php
<a title="查看商品详细信息" href="goodsshow.php?id=<?php echo $row["id"]?>"><?php echo $row["title"]?></a>

2, Shopping cart page display

Create a new goodsshow.php file

<?php
header("Content-type:text/html;charset=utf-8");
include "mysqli.php";
?>
<?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()){
?>
<div>
    <span><?php echo $row["title"] ?></span>
    <hr>
    <image src="<?php echo $row["picurl"] ?>" width="200"></image>
    <br>
    数量:-<input type="text" id="buynum" value="1">+
    价格:
    <del>市场价:<?php echo $row["marketprice"] ?></del>
    出售价:<i style="color: red"><?php echo $row["salesprice"] ?></i>
    <input type="hidden" id="id" value="<?php echo $row["id"] ?>">
    <hr>
    内容:<?php echo $row["content"] ?><br>

    <a href="javascript:;" onclick="">立刻购买</a>  <a href="javascript:;" onclick="">加入购物车</a>
    <?php
    }
    ?>
</div>

Because shopping websites basically count the number of clicks on which product a user clicks on, here we also add one to the hits field every time a user clicks

$sql="update goods set hits=hits 1 where id=".$id;

3, the effect is shown as follows:


微信图片_20180308151715.pngNext Section

<?php echo "查看商品属性功能展示";
submitReset Code
ChapterCourseware