Bluehost.com Web Hosting $6.95

Still problem with files

This is a discussion on Still problem with files within the PHP General forums, part of the PHP Programming Forums category; These files were already done from last year, so I figured I would just carry on with them. Last year ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 07-20-2003
Beauford.2005
 
Posts: n/a
Default RE: [PHP] Still problem with files

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:php-general@gremlins.biz]
Sent: July 19, 2003 1:34 AM
To: php-general@lists.php.net
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

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 07:22 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0