Jump to content

text search


Schlo_50

Recommended Posts

Hey guys,

 

I have a text file with the structure:

 

00000000|Name|Company|Address|Town|County|Post Code|Telephone|Fax|Email|JOB_TITLE|Salary|Status

 

I am trying to create a search facility where if you search for a job title any near matches are shown. I have opened the text file but am not really sure what i need to do next code wise. Could i get some input/examples please?

 

$lines = file("file.txt");
  foreach ($lines as $line) { 
$data[$key] = explode("|", $line);

$vacancy_id = trim($data[$key][0]);
$contact_name = trim($data[$key][1]);
$company = trim($data[$key][2]);
$address = trim($data[$key][3]);
$town = trim($data[$key][4]);
$county = trim($data[$key][5]);
$postcode = trim($data[$key][6]);
$tel = trim($data[$key][7]);
$fax = trim($data[$key][8]);
$email = trim($data[$key][9]);
$JOB_TITLE = trim($data[$key][10]);
$salary = trim($data[$key][11]);
$status = trim($data[$key][12]);

$read_line = fgets($line,255); 
if($read_line == $texta) 
print "$read_line<br>"; 
} 

 

Thanks very much!

 

Link to comment
https://forums.phpfreaks.com/topic/93706-text-search/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.