By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

Help with Flat File Database Image Gallery

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.