Re: Still problem with files

From: Date: Sat, 19 Jul 2003 05:34:08 +0000
Subject: Re: Still problem with files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155870@lists.php.net to get a copy of this message
On Saturday 19 July 2003 04:58, Beauford.2005 wrote: > Yep, but am I doing it right I don't know. This is the line that will be > written to the database (there will be 130 of them). > > $p = "<Option Value=\"131\">Player Name"; > > So where do I put the \r\n. I have tried just \n at the end, but same > thing. > > $p = "<Option Value=\"131\">Player Name\n"; It beats me why you're not storing the info in a DB rather than a file. Anyway here's some psuedo-code: $file = file('file); foreach ($file as $line => $data) { $file[$line] = trim($data); if (!strcmp($what_you_are_looking_for, $file[$line])) { // found, do your replacement stuff } } implode('choose a suitable EOL character(s)', $file); write_out_file(); -- 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 ------------------------------------------ /* GOOD-NIGHT, everybody ... Now I have to go administer FIRST-AID to my pet LEISURE SUIT!! */

« previous php.general (#155870) next »