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! Quote Link to comment 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). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.