File "rate-table-api.php"
Full path: /home2/santhos2/public_html/bharath-coe.firstmatrix.in.net/api/auth/rate-table-api.php
File size: 651 B
MIME-type: text/x-php
Charset: utf-8
<?php
header('Content-Type: application/json');
include '../../config/config.php'; // Ensure correct path
try {
// Prepare SQL query
$sql = "SELECT start_wt, end_wt, min_wt, min_rate, addon_wt, addon_rate FROM tbl_rate_card";
$stmt = $pdo->prepare($sql);
$stmt->execute();
// Fetch all results as an associative array
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Return JSON response
echo json_encode($data);
} catch (PDOException $e) {
echo json_encode(["error" => "Database error: " . $e->getMessage()]);
}
// Close connection (PDO doesn't require explicit close)
$pdo = null;
?>