no to ci pisalem: pokaz kod jak kombinujesz z moim artem
<table class="table table-bordered table-striped"> <thead> <tr> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM client_product INNER JOIN clients ON client_product.id_client = clients.id INNER JOIN product ON client_product.id_product = product.id ORDER BY clients.firstname, clients.lastname ASC, product.list ASC"; $result = $conn->query($sql); while ($row = mysqli_fetch_assoc($result)) { ?> <tr> </tr> <?php } ?> </tbody> </table>
<table class="table table-bordered table-striped"> <thead> <tr> </tr> </thead> <tbody> <?php $sql = "SELECT * FROM client_product INNER JOIN clients ON client_product.id_client = clients.id INNER JOIN product ON client_product.id_product = product.id ORDER BY clients.firstname, clients.lastname ASC, product.list ASC"; $result = $conn->query($sql); $client = array(); while ($row = mysqli_fetch_assoc($result)) { $id = $row['id_clientyy']; //jeśli nie było jeszcze danej kategorii, to ją tworzymy if (!isset($client[$id])) $client[$id] = array('firstaname' => $row['firstname'], 'product' => array()); //dodajemy do kategorii kolejne produkty if (!empty($row['list'])) //jeśli istnieje produkt $client[$id]['product'][] = array('firstname' => $row['list'], 'id' => $row['id_product']); ?> <tr> </tr> <?php } ?> </tbody> </table>
i taki mam efekt teraz po tym
