Appsurd
Member
Thanks for your input @FrostyCat, but I'm afraid this is not what the questioner wanted. He wanted to colour the last score of the player, and not the last score achieved by any player in the database... Your solution will therefore not work, but to get the last inserted ID this definitely does the trick.How is this even remotely difficult? Getting back the last inserted row is one of the most routine and basic tasks in SQL.
You could have used $db->lastInsertId() in the submission PHP script to get the ID of the inserted score entry, then responded with that to the client upon success. Then in the high score listing PHP script, include the ID on each entry at the top. Then the client can look through the listing for self-initiated submissions (i.e. IDs received from past responses for submissions) and draw them differently if they appear.
I really suggest that you put off teaching this subject until you have a more reasonable grasp of basic procedures.
Furthermore, I think your last sentence is not really a way we should talk to each other. We are all learning, and some are further than others. I decided to show a part of my experience with you guys, and I want to stress that I'm not an expert on the subject myself. But most experts know things too well to be able to make a simple example which is just good enough for most GM users, and of course, most experts are far too busy to put time in such a relatively simple subject as standard online highscores. This all doesn't mean that I should talk nonsense and at the same time tell that this is the absolute truth. But I hope it's clear, and I want to emphasize that very clearly, I am not an expert, just someone who is a little further in the learning curve.
@PatrikPé The solution I proposed is a little too difficult, since we already have a method to select to determine the latest ID, by simply looking at the ID value. So this changes the step-by-step method toThanks for this tutorial, works very well
I have a question - is it possible to highlight only the current line with score player just sent?
I mean, right after the game my highscore table will appear and I want only the most recent score to be drawn with different color.
1. In display.php you can change the search algorithm to find the latest score by the given player name (since you need to put this score in the eleventh position, but if you don't then skip this step) by looking at the corresponding ID value.
2. Also change the display script to return the ID of each value in the highscores
3. Go to GameMaker: Studio and open the draw_text_highscore to change the colouring mechanism and colour the player's latest score by looking at the ID.