I have a question about full text search using mysql and php.
There is text or html file data inside mysql, then  I would like
to search text from these file. when I filed some text inside text box
in web site.

mysql colum has below

b_col_id, b_col, file_name


I have wrote the code;

-------header.html---------------------------
<img src="img/seek.gif"style="position:absolute;top:95px;left:600px"
alt="search">
<form method="get"action="documentview.php">
<input type="text" name="pattern"
style="position:absolute;top:100px;left:650px">
<input type="submit" name="submit"
value="Search"style="position:absolute;top:100px;left:800px;border: 1px
solid;boder-color:#663366">&nbsp;
</form>

--------------------------------------------


--part of documentview.php--------------------------------------
class seek{
 function file_read($pattern){//retrieve_binary
   if($pattern){
      $sql_select = "SELECT * FROM view WHERE b_col = '$pattern'";
      $result = mysql_query($sql_select) or DIE ("Could not perform
                      SELECT in retrieve function ".mysql_errno().":
".mysql_error());
 echo "$result";
          if($result){
            while ($temp = mysql_fetch_assoc($result))
            {
                $filename = $temp['file_name'];
                    $fileType = $temp['file_type'];
                    $fileContent = $temp['b_col'];
                    header("Content-type: $fileType");
                header("Content-Disposition: attachment;
filename=$filename");
                header("Content-Description: PHP Generated Data");
                    echo $fileContent;
            }
            exit;
          } else {
                print "There is more then one record with that name or record
does not exist!";
          }
      }
  }//end function file_read
}// end of class seek
if ($pattern){
   //print("$pattern <br>");
   $obj1 = new seek();
   $obj1->file_read($pattern);
   exit;
}
---------------------------------------------

if anyone knows how to search text inside mysql database when I input
text box from web, please teach me how!


Regards,
Yui

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to