how could I go about detecting changes in a Mysql leaderboard? For example if a user moves ahead another the file could echo out a message such as ‘x moved one place and is now ahead of y’
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In absence of any existing code, the only recommendation I can make is to create a column in the leaderboard table which holds the user’s previous position. Whenever the user’s position is updated to a new value, simultaneously store the previous position in that column.
You can also create a column which holds a boolean indicating whether or not the user has been informed of this change. The first time the message has been displayed, the boolean is set to 1. After that you will not need to display it for the user anymore until it changes.
After displaying the new change, flag it as notified so subsequent pageviews don’t show the same message.