我有一个商品信息的页面,显示商品信息,点击添加购物车后,我通过读取数据库,将商品的信息显示到购物车页面上,但是商品数量怎么能根据添加的改变,就是想同一种商品添加几次,显示几?下面是购物车页面显示的信息。
 $sql="select * from sw_order";
  $sqlHelper=new SqlHelper();
  $res=$sqlHelper->execute_dql($sql);
  $total=0;
  echo "<div class='container'>";
  echo "<table class='table table-striped table-hover table-bordered table-condensed' style='margin-top:30px; '>";
  echo "<thead><tr class='danger'>
          <th>商品编号</th>
          <th>商品名</th>
          <th>价格</th>
          <th>数量</th>
          <th>删除</th>
        </tr>";
  while($row=mysql_fetch_assoc($res)){ 
    $price=$row['goods_price'];
    $total+=$price;
    $delete_id=$row['goods_id']; 
    echo "<tbody><tr>
          <td>{$row['goods_brand_id']}</td>
          <td>{$row['goods_name']}</td>
          <td>{$row['goods_price']}</td>
          <td>{$row['goods_number']}</td>
          <td><a href='delete.php?delete_id=$delete_id'>删除</a></td>
        </tr>"; 
  }