>I have this set of code. and what I want to know how to do is how to >filter one or more vars in the flat file? For example filter all the >people that work "at night"
Honestly, you'd be best off moving the data into a database (MySQL or otherwise)... At this point, you're starting to do a lot of work that's already been done by somebody else... >I'm assuming it has to be in this part of the code: >for($i = 0; $i < count($arr_lines); $i++) >{ > $arr_data = explode($delim, $arr_lines[$i]); $worksdelim = $arr_data[1]; echo "Works is '$worksdelim'<BR>\n"; if ($worksdelim == 'at night'){ # Or something like 'at night'... > print $arr_data[0].' '.$arr_data[1].' '.$arr_data[2].'<BR>'; } >} > >But where do I add an IF statement if that is what is needed? > ><?php > >/*assigned vars*/ >$delim = "\t"; >$file_path = "newfile.dat"; > >$name = "matt"; >$works = "at night"; >$programs = "php"; > >/*exporting data to flat file*/ >$file = fopen($file_path, "a"); >fwrite($file, $name.$delim); >fwrite($file, $works.$delim); >fwrite($file, $programs); >fwrite($file, "\n"); >fclose($file); > >$file = fopen($file_path,"r"); >$page = fread($file, 4950); > >$arr_lines = explode("\n", $page); >for($i = 0; $i < count($arr_lines); $i++) >{ > $arr_data = explode($delim, $arr_lines[$i]); > print $arr_data[0].' '.$arr_data[1].' '.$arr_data[2].'<BR>'; >} > >fclose($file); > >?> > >TIA! > >-Matt > > > >-- >Matt Zur >[EMAIL PROTECTED] >http://www.zurnet.com > >Need a Web Site??? - Visit... www.zurnet.com > >1997 - 2002 - 5th Anniversary!!! > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php