php列表

<?php $conn = new mysqli('localhost', 'root', 'root', 'qiye'); $sql = "select * from product"; $res = $conn->query($sql); $list = $res->fetch_all(MYSQLI_ASSOC); // var_dump($list);   检查 $conn->close(); ?> <table class="layui-table">                             <colgroup>                                 <col width="150">                                 <col width="200">                                 <col>                                 <col width="200">                             </colgroup>                             <thead>                                 <tr>                                     <th>产品名称</th>                                     <th>产品图片</th>                                     <th>产品详情</th>                                     <th>操作</th>                                 </tr>                             </thead>                             <tbody>                                 <?php                                 foreach ($list as $val) {                                 ?>                                     <tr>                                         <td><?php echo $val['descs']?></td>                                         <td><img src="<?php echo $val['img']?>" alt=""></td>                                         <td>人生就像是一场修行</td>                                         <td>                                             <a href="" class="layui-btn">编辑</a>   class从layui获取                                             <button class="layui-btn layui-btn-radius layui-btn-danger">删除</button>                                         </td>                                     </tr>                                 <?php                                 }                                 ?>                                                             </tbody>                         </table>
上一篇:PHP mysqli_kill() 函数


下一篇:PHP mysqli_thread_id() 函数