These files were already done from last year, so I figured I would just
carry on with them. Last year they did not have to be manipulated - so
it wasn't a big deal. I have since changed the whole thing and am now
using a database (took me a whole 45 minutes), which I was using anyway
to hold all my other info. I'd still be curious though as to why the
other way did not work.


-----Original Message-----
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: July 19, 2003 1:34 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Still problem with files


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!! */


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to