- I have some website when user can click "order" and his order i saved to orders table.
- Orders table has 3 fields:
id
,user_id
,book_id
.
I need some script which will monitor changes in orders table - if some orders appear it will read them, 'execute', and remove from orders table.
How I can efficently do it? I have never done anything like this before - I thought about some php script which will be executed in some intervals (10-15 secs - it must be fast) and will read the orders table. But then I thought that I have to keep the orders history - and there is second question - should I make second table for orders history or just add field like "completed" to orders table? I ask this two questions at once because they are corelated - maybe when my orders table will contain also completed orders querying it by my script will be unefficient. I am looking for best solution.
I use MySQL 5.0 databse...
---------- edit
I can't use triggers - I have to execute some php script to process the orders when they appear in orders table!