Help with Flat File Database Image Gallery  
Author Message
matt





PostPosted: 2005-1-9 19:37:08 Top

php-general, Help with Flat File Database Image Gallery I don't have a database available, so i'm writing an Image Gallery with
a flat file database.

I have an Add Page:
Uploads Image file, and saves $filename and $caption to text file:
captions.txt

Captions.txt is in format:
photofilename.jpg|caption to do with photo here.

I can easily read out each individual part from the captions.txt file to
display the photo and caption on a display page. I also have a delete
file that unlinks the photo, using the info in the captions.txt file,
but i can't figure out how to remove the entire line from the database
file based on the filename...??? Basically I want to click on an image
like this:
<a href=delete.php?filename=phototodelete.jpg> and have the delete.php
file unlink the picture, and then erase the line in the text file, that
begins with the filename (phototodelete.jpg).

I guess i need to search through the data file and when i match the
filename, erase the line... I'd appreciate any help with that!
Cheers
Matt
 
Janwillem Borleffs





PostPosted: 2005-1-9 23:59:00 Top

php-general >> Help with Flat File Database Image Gallery matt wrote:
> I guess i need to search through the data file and when i match the
> filename, erase the line... I'd appreciate any help with that!
>

The following might give you an idea:

http://www.jwscripts.com/playground/delete-line.phps


JW