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

$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);

$data = array();
if(mysqli_num_rows($result) > 0){
    while($row = mysqli_fetch_assoc($result)){
        $data[] = $row;
    }
}

header('Content-Type: application/json');
echo json_encode($data);
?>
