Most of the reports share a page of news release _php tutorial

Source: Internet
Author: User
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. ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.