Multiple data tables share one page of news publishing. In order to be simple and describe the main content, some secondary html content is relatively simple. When the website has multiple content to be displayed on a page, you can use one display and submit on the page. In order to be simple and describe the main content, some secondary html content is relatively simple.
When the website has multiple content to be displayed on a page, you can use one display and submit on the page.
In this example, there are two data tables (news, ctm) and one home page (index. php );
One submission page (index_pub.php; and one package page (index_view.php)
A child page (view_d.php ).
---- News, ctm ---
Increate table news (id int (80) not null auto_increment, title char (100), detail text, primay key (id ));
Increate table ctm (id int (80) not null auto_increment, title char (100), detail text, primay key (id ));
---- Index_view.php ---
$ Query = "select * from". $ name. "order by id desc limit 0, 5;
$ Result = mysql_query ($ query, $ db );
If ($ result ){
While ($ myrow = msyql_fetch_array ($ result )){
?>
& Name = "> $ Myrow [title]
}
}
Else {
Echo "there is no new content yet. ";}
?>
---- Index. php ---
$ Id = mysql_connect ("localhost", "username", "password ");
$ Db = mysql_select_db ("your_db", $ id );
?>
Yourname Online
Your current location --> homepage
$ Name = news;Include ("index_view.php ");?>
|
$ Name = ctm;Include ("index_view.php ");?>
|
Copyrignt 1999...
---- Index_pub.php ---
$ Id = mysql_connect ("localhost", "username", "password ");
$ Db = mysql_select_db ("your_db", $ id );
?>
Switch ($ db_name ){
Case news: $ name = news;
Break;
Case ctm: $ name = ctm;
Break;
}
$ Query = "insert into". $ name. "(title, detail) values ('$ title',' $ detail ');
$ Result = mysql_query ($ query, $ db );
If ($ result) {echo "OK ";}
Else {echo "failed ";}
?>
---- View_d.php ---
$ Id = mysql_connect ("localhost", "username", "password ");
$ Db = mysql_select_db ("your_db", $ id );
?>
If ($ recod ){
$ Query = "select * from". $ name. "where id =". $ recod;
$ Result = mysql_query ($ query, $ db );
$ Title = mysql_result ($ result, 0, title );
$ Detail = mysql_result ($ result, 0, detail );
Echo"
Title: ". $ title ."
";
Echo"
Content: ". $ detail ."
";
}
Else {echo "This file has been deleted! ";}
Bytes. When the website has multiple content to be displayed on a page, you can use one display and submit on the page ....