# Elementary case description
Source code download
1. The structure is as follows
conn.php To connect to the database file
index.php is the homepage, which is also the blog list page select * from weibo where $id order by id desc limit 10;
edit.php is the edit page UPDATE weibo SET `title`='$title ',`contents`='$contents' where `id`='$hid'
del.php is the delete operation page
add.php is the add page
view.php is the details page
2. Database
Field description id, hit click volume, title title, dates date, contents content
CREATE TABLE `weibo` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`hit ` int(11) NOT NULL,
`title` varchar(50) NOT NULL,
`dates` date NOT NULL,
`contents` text NOT NULL,
PRIMARY KEY (`id` )
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
3. Notes:
1. When editing, a hidden field is used in the form to pass the id
2. In the search I used where $w cleverly,
if(!empty($_GET['keys'])){
// $w = `title` like $_GET['keys'];
$ w = " `title` like '%" . $_GET ['keys'] . "%' "; //Use fuzzy search
}else{
$w = 1; //This sentence code is converted to There is no actual meaning in the sql statement.
// The sql statement is select * from `weibo` where 1 order by id desc limit 10;
}
http://www.bkjia.com/PHPjc/1114480.html