search

Home  >  Q&A  >  body text

How to write the code of DADB.class.php file

<h2>Big Apple Shopping Network</h2>

<?php session_start(); include("DADB.class.php"); $db=new DADB(); ?> <table border="1" width="100%" cellpadding=" 0" cellspacing="0"> <tr> <td>Code name</td> <td>Fruit name</td> <td>Fruit price</td> <td>Original Origin</td> <td>Shelves</td> <td>Inventory</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> // Retrieve the content we need from the database <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]}'>Add</a></td> //Shopping here is equivalent to adding to the shopping cart Functions </tr>"; } ?> <?php //This shows how many products there are in the shopping cart and the total price of the products $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"The shopping cart contains <mark>{$zhonglei}</mark> products, the total price is <mark>{$sum}</mark>元"; ?> </table> <div> <a href="gouwuche.php" rel="external nofollow" rel="external nofollow" >View shopping cart</ a> <a href="main.php" rel="external nofollow" rel="external nofollow" >Browse products</a> <a href="zhanghu.php" rel="external nofollow" rel ="external nofollow" >View account</a> </div> </body>

..1352 days ago1478

reply all(4)I'll reply

  • 思

    2021-05-14 11:21:01

    I also want to ask. . how to write

    reply
    0
  • .

    .2021-04-14 14:11:28

    The code for https://m.php.cn/article/398186.html is in this URL. Can you take a look?

    reply
    0
  • 查无此人

    查无此人2021-04-14 13:45:49

    Which project is this? Or which course? You sent it directly, the style is very messy, and I don’t know which project it is, so I can’t answer your question accurately

    reply
    1
  • .

    https://m.php.cn/article/398186.html The code is here, can you take a look?

    . · 2021-04-14 14:12:04
  • Cancelreply