Hi,
I have working code which retrieves supplier data from a database, I then want to run another query within this to display the last order date from orders table. My current code pulls through the last order date but then it stops the rest of the suppliers data being pulled through… any help is appreciated
My code is;-
$query = “SELECT * FROM
tbl_suppWHEREclient_id= ‘{$_SESSION[‘client_id_of_user’]}’ ORDER BYidDESC”;
$result = mysqli_query($db, $query) or trigger_error("Query Failed! SQL: $query - Error: ". mysqli_error($db), E_USER_ERROR);if($result) {
while($row = mysqli_fetch_assoc($result)) {echo ‘
’; ’;
echo ‘’.$row[‘name’] . ‘ ’;
echo ‘’.$row[‘tel’] . ‘ ’;
echo ‘’.$row[‘cat’] . ‘ ’;
$status = $row[‘status’]==‘APPROVED’ ? ‘success’ : ‘danger’;
echo “”.$row[‘status’]." ";{
$rowname = $row[‘name’];
$order_query = “SELECTdateFROMtbl_ordersWHEREsupplier= $rowname ORDER BYdateDESC LIMIT 1”;
$result = mysqli_query($db, $order_query);
$row1 = mysqli_fetch_array($result, MYSQLI_ASSOC);
}
echo ‘’.$row1[‘date’] . ‘ ’;echo ‘
’.$row[‘sat_ser’] . ‘ ’;
echo ‘’.$row[‘last_updated’] . ‘ ’;echo ‘
}
}