PHP text database search method searchstr=("/".preg_quote($searchstr)."/"); //$searchstr is the search keyword $records=file($file);//Get the number of all records/ /$file is the searched data file $search_reocrds=preg_grep ($searchstr, $records); //Start to search for records //$search_reocrds is the number of records found unset($records); if($search_records){ //Start To display records, write your own handler************************ while (list ($key, $val) = each ( $search_records)) { echo " $val
"; } //****************************************** ************ }