Home > Backend Development > PHP Tutorial > Small case: micro blog, case: micro blog_PHP tutorial

Small case: micro blog, case: micro blog_PHP tutorial

WBOY
Release: 2016-07-12 08:55:56
Original
967 people have browsed it

Small case: micro blog, case: micro blog

# 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

truehttp: //www.bkjia.com/PHPjc/1114480.htmlTechArticleSmall case: micro blog, case: micro blog # Elementary case description source code download 1. The structure is as follows conn.php is Connect the database file index.php as the homepage, which is also the blog list page sele...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template