Re: Searching within a Text document

From: Date: Sat, 09 Feb 2002 18:49:06 +0000
Subject: Re: Searching within a Text document
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16763@lists.php.net to get a copy of this message
Here is the code I have tried... but no luck <? include "variables.php"; $delimiter = ","; $connection = @mysql_connect($databaseserver, $databaseuser, $databasepass) or die ("could not connect to database"); $db = @mysql_select_db($databasename, $connection) or die("Could not select database"); $sql = "SELECT id, FirstName, LastName, ResumeUp FROM $canidatetable"; $result = mysql_query($sql, $connection) or die("Couldn't execute query"); while ($row = mysql_fetch_array($result)) { $id = $row['id']; $FirstName = $row['FirstName']; $LastName = $row['LastName']; $filename = $row['ResumeUp']; $fd = fopen("/home/sites/madden.williamsen.net/web/recruiter/resumes/$filename","r "); $contents = fread($fd, filesize($filename)); $keywords = explode( $delimiter, $words ); for ($i=0; $i < count($keywords); $i++) { $kw = $keywords[$i]; if( eregi($kw, $contents) ) { echo "The Words <b>$kw</b> has been found in the resume of <ol><li>$LastName, $FirstName <a href=\"http://madden.williamsen.net/recruiter/resumes/$filename\">Resume</a> </li></ol>"; } else { echo "The keyword $kw was not found in the resume $filename<br>"; } } fclose($fd); ?> "Todd Williamsen" <todd@williamsen.net> wrote in message news:20020209185121.16542.qmail@pb1.pair.com... > How would I go about doing this.. I tried to search within a MS Word > document, but that didn't work too well, since Word is not ASCII formatted, > but on the other hand, I wasn't able to search a text document created in > notepad or exported from word to a text file. > > Anyway how to do this? > >

« previous php.db (#16763) next »