Schlo_50 Posted February 29, 2008 Share Posted February 29, 2008 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 More sharing options...
tinker Posted February 29, 2008 Share Posted February 29, 2008 This is the forum dedicated to the subject, and this is the one for doing regular expressions, and here's a good starting place in the manual, then look at the syntax link (left / top). Link to comment https://forums.phpfreaks.com/topic/93706-text-search/#findComment-480129 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.