<?php
include('include/session.php');
include('connection.php');
$dbConnection = new DbConnection();
$connection = $dbConnection->connection;
if(isset($_GET['product_id'])) {
    $product_id = $_GET['product_id'];

    // Perform database query to fetch product details
    // Adjust the SQL query according to your database schema
    $sql = "SELECT product, variation, price, quantity FROM product_variation WHERE product_id = $product_id";
    $result = mysqli_query($connection, $sql);

    if(mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_assoc($result);
        echo json_encode($row);
    } else {
        echo json_encode(array('error' => 'Product not found'));
    }
}
?>