I have two tables in my database and I want to get all usernames from table 1 where all usernames in my order table 2 and I have a 2 or 3 difficult ways to do it and it's very hard through fetch Data in a while loop if somebody can help to make it easy
So I think its so clear now in the sketch I want to see all username data from Table 2 if their username storge in table 2
thank you for helping.
<?php
$showUserOrder = array('ordered'=>'User 1','ordered'=>'User 2','ordered'=>'User 2');
$userwithorder = 'SELECT * FROM usersdata WHERE username = :ordered';
$sttmsosd = $pdo->prepare($userwithorder);
$sttmsosd->execute($showUserOrder);
$GetUserWithOrder = $sttmsosd->fetchAll();
foreach($GetUserWithOrder as $gethasorder){
?>
<tr>
<td class="col-md-1 info"># <?php echo $gethasorder['id'] ;?></td>
<td class="col-md-1 info"><img src="../<?php echo $gethasorder['username'] ;?>" width="40" alt=""></td>
</tr>
<?php
}
?>