Hi, thanks for looking at our project. This should be a simple one.
We have a database that is a tab-delineated text flatfile — it’s just a flat text file, NOT mySQL.
What I need is this … two simple PHP scripts with similar functions.
Script 1:
A simple PHP script that, when run, will:
1.) query the database and find all records with a match on column 13.
2.) It should copy all of these records to a new file, named [column 13].txt. (So for example, if the records all have a column 13 value of “AAP”, the file should be named AAP.txt).
3.) It should then delete all of those matching records on the source file.
The script should run from a URL, like this:
http://www.ourdomain.com/remove.php?id=AAP
Script 2:
This script’s function is very similar, but reverse. When this script is run, it should look in the appropriate directory for the file with the string in it (i.e., AAP.txt), copy those records, and add them to the source database. It should not in any way affect any other part of the database.
The script should run from a URL, like this:
http://www.ourdomain.com/replace.php?id=AAP
So, it’s simple … one script which deletes certain listings from the database, but saves those listings in a separate file. Another script which finds those listings in that separate file, and replaces them into the database.
IMPORTANT:
We need these scripts to be as simple, as minimal, and as non-invasive as possible. Just a few lines will do. We DO NOT want a complex script which will rebuild our database from scratch each time it is run. Specifically, in no way should either one of these scripts cause any modification of the headers, the other records, the carriage-return-format, or the permissions of the database file.