I update a mysql database of user info once a day from an external service. When this user update happens, I set a flag in a table that indicates that the database is currently updating.
I have a separate php application that reads from this user database about once an hour. I want the query to return 0 results if the database is currently updating. I can do this logic in php, but am curious if I can do this with a conditional select query.
logic as follows, or if there is a better approach, please let me know.
--system_update--
currently_updating = ('yes', 'no')
last_update_timestamp =
--users--
user_id
user_name
if (system_update.currently_updating == 'no') {
select users.user_id, users_name, from users;
}
else no results;