Help needed with a small function

Good evening everyone
I am having a chatsite, and I was trying to add an something extra.

basically I am trying to create a Point and Level system, I have created two new tables, Points and Level
I managed to generate points with the following command
$mysqli->query(“UPDATE boom_users SET points = points + 1 WHERE user_id = ‘{$data[‘user_id’]}’ and last_action > ‘$delay’”);

its working fine, when users sends a message into main room, it adds one point into the Point table.

I am stuck with Level table, I want to have level system aswell,
100 points = Level 1
200 points = Level 2
and so on.

can you guys tell me how to update the Level table, or how to convert Points to Level.

thank you for your time

You could run the update query, then after that, run something like this?

SELECT user_id, points FROM table;

if (points == 100) {
UPDATE levels SET level = 1 WHERE user_id = user_id
}

One way of doing it.

Sponsor our Newsletter | Privacy Policy | Terms of Service