In order to be simple and to illustrate the main content, some minor HTML content is relatively simple.
You can use one display and submit on a Web page when you have more than one content on a site to display on a page.
In this example, there are two data tables (NEWS,CTM); a home page (index.php);
One submission page (index_pub.php; and a Package Letter page (index_view.php)
A sub-page (view_d.php).
----NEWS,CTM---
Increate table News (id int) NOT NULL Auto_increment,title char (+), detail Text,primay key (id));
Increate table CTM (id int) NOT NULL Auto_increment,title char (+), 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. ";}
?>
----index.php---
$id =mysql_connect ("localhost", "username", "password");
$db =mysql_select_db ("your_db", $id);
?>
Yourname Online
You are here--home
$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! ";}
http://www.bkjia.com/PHPjc/315359.html www.bkjia.com true http://www.bkjia.com/PHPjc/315359.html techarticle in order to be simple and to illustrate the main content, some minor HTML content is relatively simple. You can use one display and submit on a Web page when you have more than one content on a site to display on a page. ...