Forum Moderators: coopster
1- The user will submit a form
2- I will compare that last_inserted_record with all records in a table
3- After the compare i will send email alerts to those who are equal?
My Questions are:
- Should i use JOIN to compare the records?
- I want to start the compare after the user submit the form, so should i use AJAX to compare in the background? or should i use cron jobs to compare every 15 min for example?(i dont recommend this)
Also when Ajax work in the background.. does it keep working even if the user closed his browser after the submit?
Thanks in advance
so if i did cron for example every 15min then maybe several people have submitted forms.. so it will be more compares and it could work lot of times when there is nothing to compare!
But if i did it just when the user submit, then that would be the best... so thats why am thinking of XMLHTTPREQUEST... but i need to hear your opinions first?
Thanks
Thanks for your idea, i did it
"do your select and compare on submit then write all your emails to file..."
but i have 2 questions:
1. What will happen if more than 1 tried to write to the file? will it append or delete the old (which will destroy everything)
2. Why not insert the emails to MySQL, is it much faster to write to text files?
i mean if there is problem with txt files when more than 1 access it.. then the DB will be better solution.. or what?
Thanks in advance
Then when the cron runs, use it to send the email then when the cron ends, delete or move the file and there ya go.
Writing to file is just as easy as mySql...plus, if you don't want to hold on to old email updates, it's just as easy to blow away old files...don't need a db or anything, go with the flat file solution...
am worrying about when several process want to access the file.. like adding data deleting and reading to send the email.....
the problem is that its hard to test accessing the file same time.. so i think it will be better off with DB, but am still willing to hear you!
Thanks
The cron just has to make sure nothing messes with the file when it is running. You could have the cron change the name then delete the new file when it is done.
If you use multiple files then you can scan a certain directory and walk through one file at a time deleting as you go.
and the database route work too.
whatever works for you and your system is the way to go.