DADB.class.php文件的代碼怎么寫
問題描述
<h2>大蘋果購物網</h2>
<?php session_start(); include("DADB.class.php"); $db=new DADB(); ?> <table border="1" width="100%" cellpadding="0" cellspacing="0"> <tr> <td>代號</td> <td>水果名稱</td> <td>水果價格</td> <td>原產地</td> <td>貨架</td> <td>庫存量</td> <td></td> </tr> <?php $uid=$_SESSION["uid"]; $sql="select * from fruit"; $arr=$db->Query($sql); foreach($arr as $v) { echo"<tr> <td>{$v[0]}</td> // 從數據庫調出我們所需要的內容 <td>{$v[1]}</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(); if(!empty($_SESSION["gwc"])) { $ann=$_SESSION["gwc"]; } $zhonglei = count($ann); $sum=0; foreach($ann as $k) { $sql1="select price from fruit where ids='{$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="external nofollow" >查看購物車</a> <a href="main.php" rel="external nofollow" rel="external nofollow" >瀏覽商品</a> <a href="zhanghu.php" rel="external nofollow" rel="external nofollow" >查看賬戶</a> </div> </body>
問題解答
回答1:我也想問。。怎么寫
回答2:https://m.php.cn/article/398186.html代碼是在這個網址里的,可以看一下嗎回答3:這個是哪個項目?或者哪個課程? 你直接發出來,樣式很亂,也不知道哪個項目,無法準確回答你的問題
相關文章:
1. Java反射問題:為什么android.os.Message的recycleUnchecked方法不能通過反射獲取到?2. html5和Flash對抗是什么情況?3. 小程序怎么加外鏈,語句怎么寫!求救新手,開文檔沒發現4. javascript - vue-resource中如何設置全局的timeout?5. 如何分別在Windows下用Winform項模板+C#,在MacOSX下用Cocos Application項目模板+Objective-C實現一個制作游戲的空的黑窗口?6. javascript - 在 vue里面用import引入js文件,結果為undefined7. 前端 - node vue webpack項目文件結構8. php如何獲取訪問者路由器的mac地址9. php - 微信開發驗證服務器有效性10. thinkPHP5中獲取數據庫數據后默認選中下拉框的值,傳遞到后臺消失不見。有圖有代碼,希望有人幫忙
