I'm creating a new web application and I only want to update certain tables when the db is changed, this will be done by firing off a PHP script in a JavaScript setInterval.
My issue is that I am having a hard time trying to find a way to easily determine if certain rows in the database table have changed. In other instances I have used "show table status" and compared that against the last update_time that I had already stored.
In this case though, I don't want to look at the entire table, I just need to know if the rows in my query have changed. I originally tried to md5 the array, as well as md5 on the serialization of the array. It seems that neither of them work and return the same md5 hash each time.
Just for example, here is my query:
$getUserTable = mysql_query("select * from uct_admin.resources where teamID='62' order by ResourceName");
Solution that I came up with after reading the answers:
$getUserTable = mysql_query("select * from uct_admin.resources where teamID='62' order by csiname");
while ($row = mysql_fetch_assoc($getUserTable)) {
$arrayTest[] = $row;
}
$hash = md5(http_build_query($arrayTest, 'flags_'));
This works perfectly due to the nested array returned from the query.