1. Write a display article classification page:
First, you need to query the cms_category data table and add the following code to category.php:
<?php $sql='select id,name,sort from cms_category order by sort'; $category=$db->fetchAll($sql);
Modify the categoryListHtml.php page
Add the code as follows:
<?php <!--展示文章分类功能--> <table border="1" cellpadding="3" cellspacing="0" width="20%"> <tr bgcolor="skyblue"> <td align="center">排序</td> <td>分类名称</td> <td align="center">操作</td> </tr> //遍历展示分类信息 <?php foreach ($category as $v):?> <tr> <td><input type="text" name="<?php echo $v['id'];?>" value="<?php echo $v['sort'];?>"></td> <td><?php echo $v['name'];?></td> <td><a href="#">删除</a>|<a href="">编辑</a> </td> </tr> <?php endforeach;?> </table>
2, introduce and add error message
require './header.php';
3, Refresh the page display
##4, Click to add page effect display
If you don’t want to write data, click to add as follows:
To write data, click to add as follows: