Alright so I've been trying to replace a number from the database for the actual name, unfortunately it only returns nothing at all.
I'm not sure what I'm doing wrong here, Tried it multiple ways, as explained on other related questions, yet it doesn't seem to work. The first while seems to work, but the second doesn't do its job..(although in this setup it gives nothing at all)
here is my code:
<?php
include_once 'db_connect.php';
$query = "SELECT bestel_nummer, bestel_datum, bestel_tijd, kkt_id, mwr_id
FROM bestellingen";
$response = mysqli_query($mysqli, $query);
if ($response){
echo '<table align="left" cellspacing="5" cellpadding="8">
<td align="left"><b>bestel nummer<b></td>
<td align="left"><b>bestel datum<b></td>
<td align="left"><b>bestel tijd<b></td>
<td align="left"><b>klanten nummer<b></td>
<td align="left"><b>Medewerker<b></td></tr>';
while($row = mysqli_fetch_array($response)){
$mwr_id = $row['mwr_id'];
$query2 = "SELECT 'voornaam' FROM 'medewerkers' WHERE 'mwr_id' = $mwr_id LIMIT 1";
$response2 = mysqli_query($query2, $mysqli);
while($row2 = mysqli_fetch_array($response2)){
echo '<tr><td align="left">'.
$row['bestel_nummer'].'</td><td align="left">'.
$row['bestel_datum'].'</td><td align="left">'.
$row['bestel_tijd'].'</td><td align="left">'.
$row['kkt_id'].'</td><td align="left">'.
$row2['voornaam'].'</td><td align="left">';
echo'</tr>';
}
}
echo'</table>';
}
else{
echo 'couldnt issue database query';
echo mysqli_error($mysqli);
}
mysqli_close($mysqli);
?>
Thanks in advance.
</div>