filter records... how?
| From: | Matt Zur | Date: | Tue, 27 Aug 2002 21:34:50 +0000 |
| Subject: | filter records... how? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-114285@lists.php.net to get a copy of this message | ||
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"
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]);
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
mattz@zurnet.com
http://www.zurnet.com
Need a Web Site??? - Visit... www.zurnet.com
1997 - 2002 - 5th Anniversary!!!