Hello all,
I have a file that keeps info for a forum. I inherited this nightmare so I am dealing with it till I integrate another forum.
The text file looks like this
0|||Eric|||eric@domain.com|||
12|||Sally|||sally@here.com|||
18|||Joe|||joe@domain.com|||
I wrote this code to delete a user from this file but I am having issues
$filename = './users.php';
$to_replace = "18|||";
$farr = file($filename, "r");
$line = array_search($to_replace, $farr, FALSE);
array_splice($farr, $line, 1);
$contenu = implode("\n", $farr);
$fp = fopen("users.php", "w+");
fputs($fp, $contenu);
fclose($fp);
But All I end up with now is a file that looks like this:
0|||Eric|||eric@domain.com|||
12|||Sally|||sally@here.com|||
18|||Joe|||joe@domain.com|||
and it doesnt delete it just seems to add \n's to it.
I need to be able to find the entry by their id #
thx for any pointers
Eric