Schlo_50 Posted April 11, 2008 Share Posted April 11, 2008 Hi guys, I have a text area in which users can enter one keyword per line. I have split the key words into an array like so: $search = $_POST['b']; $skill = (str_word_count($search, 1, 'àáãç')); Now I have those keywords, how would I go about using them to search a .DAT file for any skills matching my keywords and then print out that line of data? My .DAT file looks like: id|name|number|skills|email Could someone please show me? I need an efficient way of doing this and can't find one myself.. Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/100633-file-search/ Share on other sites More sharing options...
friedemann_bach Posted April 11, 2008 Share Posted April 11, 2008 I would try something like this (assuming that your .DAT file is $dat_file_name and the user search string is $user_entry): $dat = file($dat_file_name); foreach ($dat as $line) { if (strpos($line,$user_entry)) { echo $line."<br>\n"; } } Link to comment https://forums.phpfreaks.com/topic/100633-file-search/#findComment-514673 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.