I create a MD5 hash with the data plus a salt and store it on the database.
Example:
Score: 1234
Lives: 3
Calculate MD5 from: "fsjdhASd8adnsa9asdmasdsd#1234#3#AS88asdDA*ASD8ASdmas"
Store on the database: 1234|3|b7f67f11fed055cce28d6f50fd829e9c
When reading from the database, I concatenate the score and lives values with the salt that I know and check if it matches with the md5 hash stored.
Example:
Read score = 1234
Read lives = 3
Concatenate "fsjdhASd8adnsa9asdmasdsd#" + score + "#" + lives + "#AS88asdDA*ASD8ASdmas"
Calculated MD5 = b7f67f11fed055cce28d6f50fd829e9c
Calculate the MD5 from this string and check if it matches with the stored hash
If the score was altered to 9999, I would get hash 0d64ebead4451f826c15b5d03853f8da and hence it is not valid!
Obviously this is not infallible, the user might reverse engineer the code and change it, but it makes things harder!
Some people still try to modify it, but then I send a message to the server marking the user as a cheater!