I have 2 tables
rankID | name
- 1 | new
- 2 | learner
- 3 | experienced
- 4 | pro
And another with all the user info and passwords and stuff
id | username | rankID
- 1 | hello | 3
- 2 | hey | 3
I have come so far so I can display their rank number, but I want to display the rank name. How can I do that? I have tried a lot of things but I'm not so good at sql and the php part of it.
This is the code I use to display the rank number
//Get rankID
$query = "SELECT rankID FROM users WHERE id = '$userId'";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);
$rank = $row['rankID'];
And to display the rank number:
Rank: <?php echo $rank; ?>