I have 2 tables, one called users and there is table called role_id, which gets data from second table called roles using foreign key. So role_id is an id of role but I want to get the value, which is located in roles table and print it instead of id. I don't even have a clue how to do it. So if we look at the code: I want to echo value of the role instead of role_id, but it is located in another table
$querytable = mysqli_query($con, "SELECT * from users WHERE role_id = '2' OR role_id = '1'");
while($row=$querytable->fetch_assoc()):?>
<tr><td><?php echo $row['username'];?></td>
<td><?php echo $row['fio'];?></td>
<td><?php echo $row['password'];?></td>
<td><?php echo $row['role_id'];?></td>
<td><?php echo $row['salary_fix'];?></td>
<td><?php echo $row['salary_percent'];?></td></tr>
<?php endwhile;?>