<?php
session_start();
include_once 'shikanisha.kts.php';

      // Retrieve the list of vendors from the database
      $sql = "SELECT vt.id, vt.vendor_id, vt.amount_transacted, vt.transaction_type, v.vendor_name, v.vendor_address, v.vendor_phone, v.vendor_email, v.company 
      FROM vendor_transactions vt 
      INNER JOIN vendors v ON vt.vendor_id = v.vendor_id";
      $result = mysqli_query($conn, $sql);

      // Loop through the list of vendors and display them in a table row
     if(mysqli_num_rows($result) > 0){
	while($row = mysqli_fetch_assoc($result)){
        echo "<tr>";
        echo "<td>".$row['vendor_name']."</td>";
        echo "<td>".$row['amount_transacted']."</td>";
        echo "<td>".$row['transaction_type']."</td>";
       echo "<td><button type='button' class='btn btn-danger delete_trans' data-id='".$row["id"]."'>Delete Transaction</button></td>";

        echo "</tr>";
      }
     }
    ?>