人大複印資料處理常式_查詢篇_PHP教程

來源:互聯網
上載者:User
//本程式為一個搜尋,目前設計服務於文章庫。
//編者:孔秀祥。日期:2001/4/10
if(!$UploadAction):
require "config.php3";
if(!isset($table)){
//$table="artical";
}
/*
$link_id=@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("不能串連資料庫!");
@mysql_select_db("$dbname") or die("不能選擇資料庫!");
$q="select count(id) from $table where 1 ";
$result = @mysql_query($q);
$row = @mysql_fetch_array($result);
$r_count=$row["count(artical_id)"];
*/

?>
資料庫搜尋








本程式運行較費時間,需要耐心等待。





else:

require "config.php3";
$UploadAction=0;
$added=0;
$die=0;
$single_chinese=0;
$TimeLimit=0; /*設定逾時限制時間預設時間為 30秒設定為0時為不限時 */
set_time_limit($TimeLimit);

if($data_search==""){
//做全庫的索引
header("location:\progs\data_index.php3");
//$msg="搜尋內容不可為空。";
//xueroom_error_exit($msg,$PHP_SELF);
}


$link_id=@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("不能串連資料庫!");
@mysql_select_db("$dbname") or die("不能選擇資料庫!");
//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="沒有符合要求的記錄。";
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)) //可以用於尋找單個漢字。
// if(strpos($data,$data_search)){ //大於一個漢字時採用本判斷式,速度較快。
$index_data.="$title作者:$author ";
$count++;
//fputs($fp, "$title作者:$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_title
rn";
$dte_created=date('Y-m-d H:i:s');
$html_header.="$index_describe 發現了 $count 條/查詢日期:$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 條"); fputs($fp, "查詢日期:$dte_createdrn"); fputs($fp,"


rn"); fputs($fp, $index_data); fputs($fp, "















"); fclose($fp); echo"點這裡看新加入的檔案索引"; } */ 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 條"); fputs($fp, "查詢日期:$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? //本程式為一個搜尋,目前設計服務於文章庫。 //編者:孔秀祥。日期:2001/4/10 if(!$UploadAction): require config.php3; if(!isset($table)){ //$table=arti...

  • "); fclose($fp); // echo"點這裡看新加入的檔案索引"; header("location:$index_url$in_file"); //echo"索引檔案為 $index_file"; echo"返回 "; endif; ?>

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.