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.j pg|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=photo todelete.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
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.j pg|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=photo todelete.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
Comment