<?php   

  //print "Bankadan dönen cevap:" . json_encode($_POST);
  error_reporting(E_ALL); 
  ini_set('display_errors', 1);
  session_start();
  require 'functions/userfunctions.php';
  include('config/dbcon.php');
  include('includes/header.php');
  include('authenticate.php');
  //$url = $_GET['url'];
  //echo $url;
  

?>
    <div class="py-3 bg-primary">

      <div class="container">

        <h6 clasS="text-white">

            <a href="index.php">

                 Home / 

            </a>

            <a href="my-orders.php">

                 My Orders 

            </a>

        </h6>

      </div>

    </div>



    <div class="container py-5">

      <div class="">

        <div class="row">

          <div class="col-md-12">

            <table class="table table-bordered table-striped">

              <thead>

                <tr>

                  <th>ID</th>

                  <th>Tracking NO</th>

                  <th>Price</th>

                  <th>Date</th>

                  <th>Details</th>

                </tr>

              </thead>

              <tbody>

                <?php

                  $orders = getOrders();

                  if(mysqli_num_rows($orders)>0){

                    foreach($orders as $item){

                      ?>

                          <tr>

                            <td> <?= $item['id']; ?> </td>

                            <td> <?= $item['tracking_no']; ?> </td>

                            <td> <?= $item['total_price']; ?> </td>

                            <td> <?= $item['created_at']; ?> </td>

                            <td> <a href="view-order.php?t=<?= $item['tracking_no']; ?>" class="btn btn-primary">View Details</a> </td>

                          </tr>

                      <?php

                    }

                  }else{

                    ?>

                          <tr>

                            <td colspan="5"> No Orders Found </td>

                          </tr>

                    <?php

                  }

                ?>

               

              </tbody>

            </table>



          </div>

        </div>

      </div>

    </div>







    <?php include('includes/footer.php');?>