<h2>大蘋果購物網</h2>
#<?php session_start(); include("DADB.class.php"); $db=new DADB(); ?> <table border="1" width="100%" cellpadding=" border="1" width="100%" cellpadding=" 0" cellspacing="0"> <tr> <td>代號</td> <td>水果名稱</td& 產地</td> <td>貨架</td> <td>庫存量</td> <td>< ["uid"]; $sql="select * from fruit"; $arr=$db->Query($sql); foreach($arr as $v) { echo"<tr> $v[0]}</td> // 從資料庫調出我們所需要的內容 <td>{$v[1]}</td> <td>{$v[2]}</td> <td>{$v[2]}< ;/td> <td>{$v[3]}</td> <td>{$v[4]}</td> <td>{$v[5]}</ td> <td><a href='add.php?ids={$v[0]}'>加</a></td> //這裡的購物相當於添加購物車的功能 </tr>"; } ?> <?php //這裡顯示的是 購物車有多少產品,且產品的總價格 $ann=array(); "])) { $ann=$_SESSION["gwc"]; } $zhonglei = count($ann); $sum=0; foreach($ann as$k) ='{$v[0]}'"; $danjia=$db->Query($sql1); foreach($danjia as $n) { $sum=$sum $n[0]*$k[1 ]; } } echo"購物車有<mark>{$zhonglei}</mark>種商品,總價格為<mark>{$sum}</mark>元"; ?> </table> <div> <a href="gouwuche.php" rel="external nofollow" rel="externaluwnofollow" rel="external nofollow" rel="externaluwnofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow; a> <a href="main.php" rel="external nofollow" rel="external nofollow" >瀏覽商品</a> <a href="zhanghu.php" rel="ex. ="external nofollow" >查看帳號</a> </div> </body>
############