I am looking to understand a good practice for the following situation:
If my profile has some value in the database, for example: 10000
and I want to display in the page You are level "Advanced user" what is the good way of doing this?
if row[user_xp] > 10000 print "You are Advanced user"
and I change this string "Advanced user" according to a value in the database.
Way Two:
Recording another value, that holds this names like "Beginner", "Advanced user", "Pro" and if row[user_xp] > 10000 mysqli_query SET user_level = 2 (where 2 is the number that means "Advanced user")
And then when I display the string level if row[user_level] = 2 print You are $userLevel (that will print string like "You are Advanced user")
As I am very beginner, I think maybe it will depend on my needs to record that value names in the database or not. But I am really not sure for the approach.
Thank you very much for the attention and your replies!
If 10000 is some kind of value that will be changed in the future, necessarily save it in the database. It will be easy then to add or remove something from it. Then save sections in another table of database, for example:
Category: Average User; min_value: 1000; max_value: 10000
Category: Expert; min_value: 10001; max_value: 1000000
In that case You can change these settings only in one place and in the future: if for example expert user will be from 9001 You can easily change it only in one database. And the index for each user stays the same :)
Hope it helps