In this forum, less than 200 lines of code are used, and the execution speed is quite fast. The running example is http://www.hnpts.ha.cn/forummysqldata database :yxforum repository | Field | Type | Null | Key | Default | less than 200 lines of code are used in this forum, and the execution speed is quite fast. Run the example in: http://www.hnpts.ha.cn/forum
MYSQL database: yxforum
---------------------------------------------------------
| Field | Type | Null | Key | Default | Extra |
---------------------------------------------------------
| Id | int (11) | PRI | 0 | auto_increment |
| Dt | datetime | YES | NULL |
| Tp | varchar (255) | YES | NULL |
| Ct | text | YES | NULL |
| Fl | int (11) | YES | NULL |
| Ip | varchar (20) | YES | NULL |
| Un | varchar (50) | YES | NULL |
| Em | varchar (60) | YES | NULL |
| Num | int (11) | YES | NULL |
---------------------------------------------------------
Index. php:
Mysql_select_db ("××××", $ m );
?>
$ Hf_fl = $ fl;
$ Q = "select * from yxforum where id =". $ fl;
$ Mr = mysql_query ($ q, $ m );
$ Ra = mysql_fetch_row ($ mr );
?>
?>
$ Lastid = $ ra [4];
Print ("
");
Print ("
Subject:");
}
$ Q = "select * from yxforum where fl =". $ fl. "order by dt desc ";
If ($ p = "") $ p = 0;
$ Mr = mysql_query ($ q, $ m );
$ F = mysql_num_fields ($ mr );
$ Ra = mysql_fetch_row ($ mr );
$ I = 0; $ p1 = $ p * 15;/* skip the row corresponding to the specified page number */
While ($ I <$ p1)
{$ I;
$ Ra = mysql_fetch_row ($ mr );
If (! $ Ra) break ;}
?>
Latest response time |
Publisher |
Topic |
Response count |
$ X [0] = "ffffcc"; $ x [1] = "DEEFFF"; $ I = 1;While ($ ra)/* Display the current topic */{$ Ys_c = $ I % 2;Print ("
". $ Ra [1]); Print (" |
". $ Ra [6]." "); Print (" |
"); Printf ("% s", $ ra [0], $ ra [2]); Print (" |
". $ Ra [8]); Print (" |
");$ Ra = mysql_fetch_row ($ mr );$ I;If ($ I> 15) break;}?>
Design Tool for Forum program version 0.25: PHP MYSQL
Old Yi Qingjian production
Xiaoyao Feihu Multimedia Workshop 2000
Addnew. php:
Mysql_select_db ("×××××", $ m );
$ Zw = ereg_replace ("<", "<", $ zw );
$ Zw = ereg_replace (">", ">", $ zw );
$ Zw = ereg_replace ("n ","
", $ Zw );
$ Zw = ereg_replace ("", "", $ zw );
$ Tt = ereg_replace ("<", "<", $ tt );
$ Tt = ereg_replace (">", ">", $ tt );
If ($ nm = "") $ nm = "";
If ($ em = "") {$ nm. = "<-- is a newbie without MAIL"; $ em = "No ";}
$ Err = strlen ($ tt) * strlen ($ zw );
If ($ err = 0)
$ Msg = "Don't be lazy! It is not too late to enter the form and submit it again. ";
Else {$ q = "insert into yxforum (dt, tp, ct, fl, ip, un, em, num) values"
. "(Now (),"". $ tt. "","". $ zw. "",". $ fl. ","". $ REMOTE_ADDR. "","". $ nm. "","". $ em. "", 0 )";
Mysql_query ($ q, $ m );
$ Q = "select num, fl from yxforum where id =". $ fl;
$ Fl_a = $ fl;
Do {$ mr = mysql_query ($ q, $ m );
$ Ra = mysql_fetch_row ($ mr );
$ Num = $ ra [0] 1;
$ Q = "update yxforum set dt = now (), num =". $ num. "where id =". $ fl;
$ Fl = $ ra [1];
Mysql_query ($ q, $ m );
$ Q = "select num, fl from yxforum where id =". $ fl;
} While ($ fl> 0 );
$ Msg = "your comments have been submitted successfully! ";
}
?>