Lets say I have a system, in which the operator opens a slot (which creates a new row in a mySQL DB) and then a QR code appears on screen. The user scans it with his iPhone, then presses ‘approve’, which changes one of the columns in the new row to true.
How can I make it so when it does change to true, a message will pop up on the operator screen?
I thought of two ways that might be possibly done:
- a change in the row can trigger something that will push a message to the operator’s machine.
- if the operator can go into a page, that will only load up when the row =
true, but I can’t figure out how to do that.
If you know how to do some of the stuff I listed above, or have a different idea, please share it, it will be highly appreciated 😀
I would use an AJAX call. Make a php page that checks the database and returns a very simple yes/no response that can be read by javascript. Then, use ajax to query that on an interval (such as every 5 seconds) until the page returns a yes. After that, you can easily alert the user (the javascript alert() function would work, or you might want to code up something fancier).