简体   繁体   中英

How do I update a value on a page instantly (or ASAP) when it's updated in MySQL database? (without refresh)

Is there a way to pull a value from a MySQL database instantly (or within a second or less) when it is updated and display it on a page without refreshing the page?

The idea is that 2 people sitting at their computers are "racing" to update the value and whoever does it first "wins". If User A clicks a link first, the value will update and User B will see the number change from 0 to 1 and his ability to click the link will disappear.

I am good with clicking a link to change the value from 0 to 1, but I'm not sure how to make the value instantly change for the other guy once the value has already been changed.

I'm starting to think this is just a bad idea for a web app. Regardless, I'd like to know how to do it if it's possible.

This might not be possible with mysql. As mysql does not support realtime communication, it needs something like websockets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM