Article classification added function

1, write article categories and add templates

Create a new categoryListHtml.php file, the code is as follows:

 

后台文章分类管理

分类名称:

The interface is shown as follows :

微信图片_20180306151229.png

2, enter the category information to submit the form

Create a new category.php file Get the data submitted by the form, and then write the data into the database. The specific code is as follows:

data($data)->fetchRow($sql)){ $error[]="该文章分类已存在"; }else{ //插入到数据库 $sql="insert into cms_category(name)values(:name)"; $db->data($data)->query($sql); } } } } require './categoryListHtml.php';

Click to add:

微信图片_20180306152710.png

##The database is displayed as follows:

微信图片_20180306152841.png

微信图片_20180306152710.png

Click to add and observe the database information:


Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!