[PHP] 商品显示 →→→→→进入此内容的聊天室

来自 , 2021-03-21, 写在 PHP, 查看 133 次.
URL http://www.code666.cn/view/1fffeb21
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>商品显示页面</title>
  6. <!--设置表格格式-->
  7. <style type="text/css">
  8.   table,th,td{  border:#000 solid lpx;}
  9.      table      {
  10.                  width:980px;
  11.                  margin:auto;
  12.                  font-size:14px;
  13.                  }     
  14.         caption{
  15.                 font-size:24px;
  16.                 font-weight:bold;
  17.         }
  18.         </style>
  19.                                  
  20.                          
  21. </head>
  22.  
  23. <body>
  24. <?php
  25.    //连接数据库
  26.    require "public/dbcn.php";    //引入设计好的数据库连接
  27.    $dbcn->exec('set names utf8'); //设置数据库的存储编码为utf8
  28.    $sql="select*from products";    //构造查询语句
  29.    $rs=$dbcn->query($sql);    //执行sql查询语句获取联合数组结果集
  30.    ?>
  31.     <table align="center">
  32.         <caption>产品列表</caption>
  33.         <tr>
  34.         <th>编号</th><th>商品名称</th><th>商品规格</th><th>价格</th><th>库存量</th><th>图片</th><th>网址</th>
  35.         </tr>
  36.         <?php
  37.         //通过循环取出每一条记录填入每行中
  38.         while($rows=$rs->fetch(PDO::FETCH_ASSOC)){
  39.                 echo'<tr>';
  40.                 echo'<td>'.$rows['proID'].'</td>';
  41.                 echo'<td>'.$rows['proname'].'</td>';
  42.                 echo'<td>'.$rows['proguide'].'</td>';
  43.                 echo'<td>'.$rows['proprice'].'</td>';        echo'<td>'.$rows['proamount'].'</td>';
  44.                 echo'<td>'.$rows['proimages'].'</td>';
  45.                 echo'<td>'.$rows['proweb'].'</td>';
  46.         echo'</tr>';
  47.         }//执行
  48.         ?>
  49.         </table>
  50. </body>
  51. </html>

回复 "商品显示"

这儿你可以回复上面这条便签

captcha