well, I have a script which processes some data, and then it imports it in a mysql database.
Then, I also have another script which processes some other data, and then it also imports it in a mysql database.
What I want to do:
I want with a 3rd script to control (e.g., see how many rows were last imported) only the rows that were imported with the last script. Not these imported by the first (but i don’t want the first imported rows to be deleted to have only those last imported).
Is there some way in MySQL or PHP for that?
If i’m unclear about something tell me.
Thank you in advance!
You could always add a
last_importcolumn to your database. Every time your script imports something to a mysql database, before it imports, it changes all the values oflast_importto no or something similar, then inputs its rows with a value of yes or something similar. Using this method, you can easily tell which ones were last imported.Say this is your database:
Add this field:
So if you’re using mysql (tell me if you aren’t), do this every time you insert and process your data:
Then in your final checking file:
That should work.
UPDATE: Thanks to Gavin’s suggestion (Thanks Gavin!) I also suggest using a timestamp value. This would work like this:
Your table will be like this:
And in your insert queries:
And when selecting: