Re: PHP Newbie, Experienced Porgrammer, Annoying fread() problem
| From: | Brian Clark | Date: | Wed, 07 Feb 2001 19:18:06 +0000 |
| Subject: | Re: PHP Newbie, Experienced Porgrammer, Annoying fread() problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38603@lists.php.net to get a copy of this message | ||
Hi John,
@ 2:01:49 PM on 2/7/2001, agathorn@cfl.rr.com wrote:
> Please bear with me for a moment. I am new to PHP work, but have
> over 10 years experience in various other programming languages
> including C/C++
> I'm just getting really frustrated here, and i'm hoping its a simple
> mistake. What I am running into is that ever file I open and read
> from, I never actually get any data. I know the data is in the file,
> but I don't get it. I can write to it fine.
[...]
> If anyoen can clear this up for me, I would most appreciate it. I'm
> on a tight deadline, learning PHP as I go, and losing my mind on
> this seemingly simple excersise!
Obviously, James has answered your question, but I'm curious as to why
you aren't using a database for this particular task?
Another suggestion, for the actual book data file(s) is to just
include the 'cosmetic' information in with the actual $book_data when
you write it to disk.
IOW, instead of doing this:
$book_data = explode("\n", $book_data_in);
echo "ASIN:";
echo "$book_data[0]";
echo "<br>";
echo "Title:";
echo "$book_data[1]";
echo "<br>";
echo "Description:";
echo "$book_data[2]";
echo "<p></p>";
Why didn't you just write that information to the file from the very
beginning?
If you were to do that, all you'd need to do is use include() instead
of 'module 2, the reads'
It just seems like that would be a lot less painful.
-Brian