September 9th, 2013, 06:59 AM
Ideas for a script to send data to our and client's db
background: I create user entry pages where users come and enter their details. These details go to our database and sometimes I also send them to our clients.
Sometimes there may be problems and I am saving users' data on the server outside root of course.
Now I am writing a script that will check this folder automatically ( cron job) and then try to process the data. If the data needs to go to our partner, i would have to factor this into our script as well.
so far this is how i am thinking of doing:
script will then read all directories underneath data folder, open them up read config.txt determine if it is csv or xml and then send the data to our database/
either file.csv or files with one xml each
Now i am thinking that i should just have CSV because if i have xml then i would need to "extract" the data if i need to send it to my partners. For files in csv, i am thinking to provide an xml template and then use sprintf to put csv into xml.
Q; how do i factor in the clients system? i would probably need to write a class per client anyway but how do I use this in my script
Q: does anyone see any potential problems?
Q: should I use this script as a linear procedural way or try to make it all OOP. (Note: procedural way will be using some classes ) but the script is nothing more than looping through directories to get the data etc.