# Primary Case Description
SOURCE download
First, the structure is as follows
conn.php to connect to the database file
index.php first page, also the blog list page select * from Weibo where $id order by id desc limit 10;
edit.php for edit page UPDATE Weibo SET ' title ' = ' $title ', ' contents ' = ' $contents ' where ' id ' = ' $hid '
del.php The Delete action page
add.php for adding pages
view.php for details page
Second, the database
Field Description ID, hit volume, title title, dates date, contents content
CREATE TABLE ' Weibo ' (
' ID ' int (5) not NULL auto_increment,
' Hit ' int (one) is not NULL,
' title ' varchar (not NULL),
' Dates ' date not NULL,
' Contents ' text is not NULL,
PRIMARY KEY (' id ')
) Engine=myisam auto_increment=6 DEFAULT Charset=utf8;
Third, the attention point:
1. When editing, use a hidden field in the form to pass the ID
2. The where $w is used skillfully when searching,
if (!empty ($_get[' Keys ')) {
$w = ' title ' Like $_get[' keys ';
$w = "' title ' Like '% '. $_get [' Keys ']. "%' "; Using Fuzzy search
}else{
$w = 1; There is no practical meaning in translating this sentence code into an SQL statement.
The SQL statement is select * from ' Weibo ' where 1 order by id DESC limit 10;
}
Do not understand please leave a message (: moka_2024)
The above describes the small case: micro-blog, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.