I have a simple SQL Server database with 12 tables. Each table has 100 to 1000 rows. These tables are saved directly into arrays when my web app loads. From that point on, the arrays are used rather than direct table access. The arrays need to be updated whenever another user changes the data in the database.
To do this, I'm planning on using ajax to poll a PHP script every 10 seconds. This script checks for changes on any of these 12 tables and returns to the client machine only the changes that have been made rather than the whole table.
The problem is, I don't know how to record any changes to these 12 tables and then return those changes to the client machine in a way that they can be interpreted in Javascript to update arrays.
What is the best/easiest way to keep track of changes to tables in SQL Server?
Perhaps a clearer way to ask my question that is more widely applicable - what methods are there to query or discover changes to SQL Server tables over time?