Hopefully someone can help me out with a bit of a quandry.

I am writing up PHP for a registration system which will be reused on an annual basis. I want to take the entries in a number of tables and archive them before clearing the tables to be used with the new year's data.

I can grab the data from the tables and create a CSV string from the information (lets say $table_data)

Now that I have that string, I want to turn it into a file which will be inserted into an archive table which will have the following columns: id_no, date_created, file_name, file_size, content.

I can simply insert the string to content, but does this turn it into a file, or is there some magical process I don't know about?

7 Years
Discussion Span
Last Post by sudeepjd

Do you intend to back the data up to a file or to another table? Inserting data into a table does not create a file.

If you want to create a file you can use the PHP file functions $handle = fopen("backup.txt", "w"); and then write to the file.

If you want the archive database to be searchable later just use the MySQL Insert command into the archive table.

If your still not clear about it, post the code which you have and the line which you have a problem with. Will try and help you out.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.