
March 30th, 2004, 01:11 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 7
Time spent in forums: 14 m 2 sec
Reputation Power: 0
|
|
Help! outputting array contents in text file
Hi!,
I'm having a problem using a text file as a flat db to store music details in.
I have each album's details stored on a seperate line with the fields (ID, artist, album title, genre, record label, year and rating) seperated by only a # symbol. I've managed to add albums (one at a time) using fopen (...."a"), I can list them in a HTML table and even search by specific criteria Eg title, artist, id, genre etc, using a complex (for a noob like me) array / explode / strstr / strpos etc. and then listing the matches in a HTML table again.
Now for the part which has me... Deleting:
I am reading the details from the text file and storing them in an array, where I explode("#") them into another array (2D still) so they are stored from first album to last with each new field as a new element in the array (Probably wrong way to do it but worked with my "List albums" page).
In the HTML table beside each album in the table there is a checkbox so they can be "marked for delete", and when the submit button is clicked it runs an if statement:-
if (isset($_POST['godel']) && ('deleteproc' == $_POST['godel']))
__________________________________________________ ______________
//Please see attached code. My boss told me to use Input type= "hidden"//
__________________________________________________ _____________
Then with the "deleted" albums unset from the array I basically I want to copy all array elements that !="" to a new array and then write them to a text file "Music.mus".
I've tried for ages and I can mark the albums "to delete", click "delete(submit button)", but then it doesn't seem to alter my text file, it stays the same as before! Please help, and many apologies for the long POST
|