PHP + ACCESS document management program code

Source: Internet
Author: User
It took a day to write a php access operation demo whole site sample program (excluding paging and secondary classification) The code is as follows:


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


Biyuan Network PHP + ACCESS article management system




// ==========================================
// Connect to the database
// ==========================================
@ $ 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 \ r \ n ";
$ 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"











\ R \ n"." \ R \ n"." \ R \ n"." \ R \ n ";While (! $ Rs-> Eof ){Echo" \ R \ n"." \ R \ n"." \ R \ n ";$ 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 ."
\ R \ n ";
}
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"












\ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"." \ R \ n"."
". $ 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]
\ R \ n"
."

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.