When you insert a new entry for the user. Just run this query before (don't forget where-condition):
DELETE FROM tablename WHERE userID = 'currentUserId' LIMIT 9, 999999
After that you can insert new data. This always saves data for ten records for each user.
INSERT INTO tablename VALUES(....)
source
share