Reputation: 85
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:
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 :D
Upvotes: 0
Views: 2427
Reputation: 9262
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).
Upvotes: 1
Reputation: 3460
Easy solution:
Just create a flag in your database boolHasBeenShowed
. When someone presses approve you set the boolHasBeenShowed
to true.
When the operator opens the admin page, check the database for all the records WHERE boolHasBeenShowed = TRUE
. As soon as they have been showed, UPDATE
the boolHasBeenShowed = false
. That way you will only see the newly approved records.
Upvotes: 0