NPC People's Congress photocopies _ query _ PHP Tutorial

Source: Internet
Author: User
NPC deputies to the People's Congress copy data processing procedures _ query articles .? This program is a search, currently designed to serve the Document Library. Editor: Kong Xiuxiang. Date: 2001410if (! $ UploadAction): requireconfig. php3; if (! Isset ($ table) {$ tablearti // This program is used for a search. Currently, it is designed to serve the Document Library.
// Editor: Kong Xiuxiang. Date: 2001/4/10
If (! $ UploadAction ):
Require "config. php3 ";
If (! Isset ($ table )){
// $ Table = "artical ";
}
/*
$ Link_id = @ MYSQL_CONNECT ($ hostname, $ dbusername, $ dbpassword) or die ("cannot connect to the database! ");
@ Mysql_select_db ("$ dbname") or die ("You cannot select a database! ");
$ Q = "select count (id) from $ table where 1 ";
$ Result = @ mysql_query ($ q );
$ Row = @ mysql_fetch_array ($ result );
$ R_count = $ row ["count (artical_id)"];
*/

?>
Database search








It takes a long time to run the program.





Else:

Require "config. php3 ";
$ UploadAction = 0;
$ Added = 0;
$ Die = 0;
$ Single_chinese = 0;
$ TimeLimit = 0;/* Set the time-out period. The default time is 30 seconds. if it is set to 0, the time-out period is not limited */
Set_time_limit ($ TimeLimit );

If ($ data_search = ""){
// Complete the database index
Header ("location: \ progs \ data_index.php3 ");
// $ Msg = "The search content cannot be blank. ";
// Xueroom_error_exit ($ msg, $ PHP_SELF );
}


$ Link_id = @ MYSQL_CONNECT ($ hostname, $ dbusername, $ dbpassword) or die ("cannot connect to the database! ");
@ Mysql_select_db ("$ dbname") or die ("You cannot select a database! ");
// SELECT id, file_name, artical_author from textfile where 1 LIMIT 0, 30
If ($ table = "artical ")
{
$ Sid = "artical_id ";
$ Stitle = "artical_title ";
$ Sauthor = "artical_author ";
$ Sdata = "artical_data ";
$ Prog = "readfile. php3 ";
If ($ a_data = "month ")
$ Key_where = "where origin_periodical rlike '^. * $ data_search .*'";
}
If ($ a_data = "data ")
$ Key_where = "where $ sdata rlike '^. * $ data_search .*'";
If ($ a_data = "title ")
$ Key_where = "where $ stitle rlike '^. * $ data_search .*'";
If ($ a_data = "author ")
$ Key_where = "where $ sauthor rlike '^. * $ data_search .*'";

// $ Q = "select $ sid, $ stitle, $ sauthor from $ table where $ sdata rlike '^. * $ data_search. *' order by $ stitle ";
If ($ a_data = "data") & (strlen ($ data_search) = 2 )){
$ Q = "select $ sid, $ stitle, $ sauthor, $ sdata from $ table $ key_where order by $ stitle ";
$ Single_chinese = 1;
}
Else {
$ Q = "select $ sid, $ stitle, $ sauthor from $ table $ key_where order by $ stitle ";
}
$ Index_data = "";
$ Count = 0;
$ Result = @ mysql_query ($ q );

If (! $ Result ){
$ Msg = "no matching record. ";
Xueroom_error_exit ($ msg, $ PHP_SELF );
}
While ($ row = @ mysql_fetch_array ($ result )){
If ($ single_chinese )&&(! MyStrPos ($ row [$ sdata], $ data_search )))
Continue;
Else
{
$ Id = $ row [$ sid];
$ Title = $ row [$ stitle];
$ Author = $ row [$ sauthor];
If ($ table = "textfile ")
$ Title = preg_replace ("/. txt/", "", $ title );
// $ Data = $ row ["artical_data"];
// If (myStrPos ($ data, $ data_search) // You can search for a single Chinese character.
// If (strpos ($ data, $ data_search) {// use this simplified method when it is greater than one Chinese character, which is faster.
$ Index_data. ="$ TitleAuthor: $ author";
$ Count ++;
// Fputs ($ fp ,"$ TitleAuthor: $ author");
//}
}
}
@ Mysql_free_result ($ result );
Mysql_close ($ link_id );
Set_time_limit (30 );
If ($ index_title = ""){
$ Index_title = "";
}
$ Index_title = $ index_title. "_". $ data_search;

$ Html_header =" $ Index_title";
$ Html_header. = "$ index_titlern ";
$ Dte_created = date ('Y-m-d H: I: s ');
$ Html_header. = "$ index_describe found $ count/query date: $ dte_createdrn ";
$ Html_header. ="

Rn ";$ Data = $ html_header. $ index_data;$ Data. ="












";/* If (strlen ($ index_file) = 0 ){Header ("Content-type: text/html ");Echo $ data;}Else{$ In_file = "$ index_file ";$ Index_file = "\ index \". $ index_file;$ Fp = indexfile ($ index_file, $ index_title, $ index_describe );Fputs ($ fp, "$ count found ");Fputs ($ fp, "query date: $ dte_createdrn ");Fputs ($ fp ,"


Rn ");Fputs ($ fp, $ index_data );Fputs ($ fp ,"















");Fclose ($ fp );Echo "Click here to view the new file index";}*/If (strlen ($ index_file )! = 0 ){$ In_file = "$ index_file ";$ Index_file = "\ index \". $ index_file;}Else$ In_file = "temp.html ";$ Fp = indexfile ($ index_file, $ index_title, $ index_describe );Fputs ($ fp, "$ count found ");Fputs ($ fp, "query date: $ dte_createdrn ");Fputs ($ fp ,"


Rn ");Fputs ($ fp, $ index_data );Fputs ($ fp ,"













Http://www.bkjia.com/PHPjc/315653.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/315653.htmlTechArticle? // This program is used for a search. Currently, it is designed to serve the Document Library. // Editor: Kong Xiuxiang. Date: 2001/4/10 if (! $ UploadAction): require config. php3; if (! Isset ($ table) {// $ table = arti...

");Fclose ($ fp );// Echo "Click here to view the new file index";Header ("location: $ index_url $ in_file "); // Echo "the index file is $ index_file ";Echo"Return ";Endif;?>

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.