On Thursday 06 March 2003 04:18, Richard Kurth wrote:
> This script will remove a line from a text list of email address and
> then re-write the list. The only problem I am having is when it
> re-writes the list it adds a extra line between each record. How can I
> stop this from happening
>
> $recordsarray = file($members);
> $remove = "[EMAIL PROTECTED]";
> $temp = array();
> for ($i=0;$i<count($recordsarray);$i++)
> {
> if (!strstr($recordsarray[$i], $remove))
> {
> $temp[] = $recordsarray[$i];
> }
> }
> $recordsarray = $temp;
> $lines = implode($recordsarray,'');
> $fp = fopen($members, "w");
> fwrite($fp, $lines, strlen($lines));
> fclose($fp);
>
> This is what the list looks like befor
> [EMAIL PROTECTED]|Mr.|Richard|Kurth|1046848049|03/04/2003
> [EMAIL PROTECTED]|Mr.|Richard|Kurth|1046854222|03/05/2003
> [EMAIL PROTECTED]|Mr.|Richard|Kurth|1046848049|03/04/2003
>
> This is what it looks like after I remove a line
> [EMAIL PROTECTED]|Mr.|Richard|Kurth|1046848049|03/04/2003
>
> [EMAIL PROTECTED]|Mr.|Richard|Kurth|1046854222|03/05/2003
I tried your code and it works fine for me :-)
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Nothing is so firmly believed as that which we least know.
-- Michel de Montaigne
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php