This script is confusing the hell out of me...

What its suppose to do is do a search on documents, and then is it finds
something say who and where it is, but it repeats the message for every hit.

Same goes with the message when there is no results, it repeats it for every
record. All I want it do is say "The results for $kw"

the list here

then when no results are returned, just say the message once..

the results for "$kw" returned zero results.

here is the script

<?
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 = "/home/sites/madden.williamsen.net/web/recruiter/resumes/"
.$row['ResumeUp'];

$fd = fopen($filename,"r");

$contents = fread($fd, filesize($filename));

$keywords = explode( $delimiter, $words );

for ($i=0; $i < count($keywords); $i++) {

$kw = $keywords[$i];
=============================================
THE TROUBLE SPOT
=============================================
if( eregi($kw, $contents) )
{
echo "The Words $kw has been found in the resume of
<a href=\"show_can.php?id=$id\">$LastName, $FirstName</a>
<br>";
}
else {

echo "Your Search Returned Zero Records<br>";
}
}
}
===========================================
==========================================
fclose($fd);

?>



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

Reply via email to