People's Congress copy data Processing Program _ Inquiry Article _php tutorial

Source: Internet
Author: User
This program for a search, the current design services in the article 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 ("Cannot select database! ");
$q = "SELECT count (id) from $table where 1";
$result = @mysql_query ($q);
$row = @mysql_fetch_array ($result);
$r _count= $row ["Count (artical_id)"];
*/

?>
<title>Database search</title>








This program runs more time, need to wait patiently.





Else

Require "CONFIG.PHP3";
$UploadAction = 0;
$added = 0;
$die = 0;
$single _chinese=0;
$TimeLimit = 0; /* Set the time-out limit to the default time of 30 seconds when set to 0 is unlimited */
Set_time_limit ($TimeLimit);

if ($data _search== "") {
Make an index of the whole library
Header ("location:\progs\data_index.php3");
$msg = "Search content cannot be empty. ";
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 ("Cannot select 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 the _where order by $stitle";
}
$index _data= "";
$count = 0;
$result =@ mysql_query ($q);

if (! $result) {
$msg = "There are no records that meet the requirements. ";
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))//can be used to find individual characters.
if (Strpos ($data, $data _search)) {///greater than one Chinese character use this judgment, 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= "Learning and Lent information";
}
$index _title= $index _title. " _ ". $data _search;

$html _header= " <title>$index _title</title>";
$html _header.= "

$index _title

RN ";
$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, "found $count article"); Fputs ($FP, "Enquiry Date: $dte _createdrn"); Fputs ($FP, "


RN "); Fputs ($fp, $index _data); Fputs ($FP, "















"); Fclose ($FP); echo "Point here to see the newly added 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, "found $count article"); Fputs ($FP, "Enquiry Date: $dte _createdrn"); Fputs ($FP, "


RN "); Fputs ($fp, $index _data); Fputs ($FP, "













http://www.bkjia.com/PHPjc/315653.html www.bkjia.com true http://www.bkjia.com/PHPjc/315653.html techarticle ?//This program for a search, currently designed to serve the article library. Editor: Kong Xiuxiang. Date: 2001/4/10 if (! $UploadAction): Require config.php3; if (!isset ($table)) {//$table =arti ...

  • "); Fclose ($FP); echo "Point here to see the newly added file index"; Header ("Location: $index _url$in_file"); echo "index file for $index _file"; echo "Back"; endif;?>
    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.