PHP access simple and practical Article management program code (1/7)-PHP source code

Source: Internet
Author: User
Ec (2); & lt ;? Php tutorial session_start (); Author: biyuan time: 2006.07 contact: qq6010707? & Gt; & lt; html & gt; & lt; head & gt; & lt; title & gt; Biyuan network php teaches script ec (2); script

Session_start ();
// ==================================
// Author: biyuan
// Time: 2006.07
// Contact: qq6010707
// ==================================
?>


Biyuan network php tutorial + access Document Management System




// ==========================================
// Database connection tutorial
// ==========================================
@ $ Conn = new com ("adodb. connection ");
$ Conn-> open ("driver = {microsoft access driver (*. mdb)}; dbq =". realpath ("article. mdb "));
// ==========================================
// Article navigation
// ==========================================
Function article_menu (){
Global $ conn;
@ $ SQL = "select * from list ";
@ $ Rs = $ conn-> execute ($ SQL );
While (! $ Rs-> eof ){
Echo "| fields [2]-> value." ">". $ rs-> fields [1]-> value ."";
$ Rs-> movenext ();
}
Echo "| background management ";
$ Rs-> close ();
If (@ $ _ session ["articleadmin"] = "by_php_article "){
Echo"
Manage options-> | Category Management | post | article list | log out ";
}
}
// ==========================================
// Article list: article_list (document category id)
// ==========================================
Function article_list ($ str ){
Global $ conn;
@ $ SQL = "select id, by_title, by_name, by_time, by_count from article where by_class =". $ str. "order by id desc ";
@ $ Rs = $ conn-> execute ($ SQL );
If (! $ Rs-> eof ){
Echo"











"." "." "." ";While (! $ Rs-> eof ){Echo" "." "." ";$ Rs-> movenext ();}Echo"
Article Title Author Posting time Browsing times
Fields [0]-> value. ""> ". $ rs-> fields [1]-> value ." ". $ Rs-> fields [2]-> value ." ". Date (" y-m-d h: I: s ", $ rs-> fields [3]-> value )." ". $ Rs-> fields [4]-> value ."
";
}
Else {
Echo"
This category does not exist or there are no articles for the time being! ";
}
$ Rs-> close ();
}
// ==========================================
// Article details: article_look (Article id)
// ==========================================
Function article_look ($ str ){
Global $ conn;
@ $ SQL = "select * from article where id =". $ str;
@ $ Rs = $ conn-> execute ($ SQL );
@ $ Usql = "update article set by_count = (by_count + 1) where id =". $ str;
$ Conn-> execute ($ usql );
If (! $ Rs-> eof ){
@ $ Body = $ rs-> fields [5]-> value;
$ Body = str_replace ("[url = file: // % 22, % 22% 22, $ body/] \", "", $ body [/url]);
Echo"












"." "." "." "." "." "." "." "." "." "." "." "." "."
". $ Rs-> fields [1]-> value ."
Author :". $ rs-> fields [2]-> value. "| posting time :". date ("y-m-d h: I: s", $ rs-> fields [3]-> value ). "| browsing times :". $ rs-> fields [4]-> value."
". $ Body ."
[Back] [print] [close]
"
."
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.