<?php 
include('include/session.php');
// session_start();
include('include/navigation.php');
include('connection.php');
$dbConnection = new DbConnection();
$connection = $dbConnection->connection;
?>
<html lang="en">
<head>
    <link rel="stylesheet" href="assets/css/style.css">
<?php
include('include/header_links.php');

?>
<body>
    <div class="container_main">
    <button class="reset-button"><a href="_order_list.php"><i class="fa-solid fa-backward"></i></a></button>
        <h1>Invoicing List</h1>
      
        <table class="table table-striped">
  <thead>
    <tr>
      <th scope="col">S.no</th>
  
      <th scope="col">Cuid</th>
      <th scope="col">Category</th>
      <th scope="col">Product</th>
      <th scope="col">variation</th>
      <th scope="col">Price</th>
      <th scope="col">Traully Number</th>
    
    </tr>
  </thead>
  <tbody>
  <?php
                   
    $query = "SELECT * FROM  order_list";
                    $result = mysqli_query($connection, $query);
                    $id = 1;

                    if ($result && mysqli_num_rows($result) > 0) {
                        while ($row = mysqli_fetch_assoc($result)) {

                            echo "<tr>";

                            // Output sales data
                            echo "<td>{$id}</td>";
                           
                            echo "<td>{$row['c_uid']}</td>";
                            echo '<td>';
                                    $category = explode(",", $row["category"]);
                                    $i = 1.;
                                    foreach ($category as $categories) {
                                        echo $i . " " .$categories. "<br>";
                                        $i++;
                                    }
                            echo '</td>';

                    
                            echo '<td>';
                                        $product = explode(",", $row["product"]);
                                        $i = 1;
                                        foreach ($product as $products) {
                                            echo $i . " " .$products. "<br>";
                                            $i++;
                                        }
                            echo '</td>';


                              echo '<td>';
                                        $variation = explode(",", $row["variation"]);
                                        $i = 1;
                                        foreach ( $variation as  $variations) {
                                            echo $i . " " .$variations. "<br>";
                                            $i++;
                                        }
                            echo '</td>';


                           
                              echo '<td>';
                                        $price = explode(",", $row["price"]);
                                        $i = 1;
                                        foreach ( $price as  $prices) {
                                            echo $i . " " .$prices. "<br>";
                                            $i++;
                                        }
                            echo '</td>';
                            echo "<td>{$row['traully_number']}</td>";
                      
                           
                            echo "<tr>";
                            $id++;
                        }
                    }
                    ?>
  </tbody>
</table>
</div>
<section class="footer">
<?php
    include_once("include/footer_two.php");
?>
</section>
  </body>
 
  <?php 
 include("include/footer_link.php");
  ?>
<script src="assets/script/script.js"></script>
</html>

</html>