how can i join the user id from list and show the username from users table
into this script i dont know how joins work i have looked and try
to do it in this but it confusing me
<?php
$sql = "SELECT list.*,count(username) as faucet FROM list GROUP BY username";
$result = mysqli_query($link, $sql);
if( $result )
while($user = mysqli_fetch_assoc($result)) {
?>
<table class="table table-striped" id="faucetlist" width="100%" cellspacing="0">
<thead>
<tr>
<th><center>Faucetlist</center></th>
<th><center>Created</center></th>
<th><center>Last updated</center></th>
<th><center>faucets</center></th>
</tr>
</thead>
<tr>
<td><center><?php echo $user["username"]; ?></center></td>
<td><center><?php echo date('l jS F Y' , strtotime($user['Published']));?></center></td>
<td><center><?php echo date('h:i A' , strtotime($user['last_update']));?> </center></td>
<td><center></center><?php echo $user['faucet']; ?></td>
</table>
<?php } ?>
```
Pictures are for hanging on the wall and they dont import to a DB structure and I have no idea what table that is. Just post the table Sql. I can add some fake data.
EDIT: You just need a basic JOIN on the two tables joining on the user id column of the users table and the username column of the other table.
<?php
$sql = "SELECT
u.username,
l.faucet_name,
l.id,count(username) as faucet
FROM
users u
INNER JOIN list l ON l.username = u.id GROUP BY l.username";
$result = mysqli_query($link, $sql);
if( $result )
while($user = mysqli_fetch_assoc($result)) {
?> ```