<?php
// Simple test file to check panchang management issues
error_reporting(E_ALL);
ini_set('display_errors', 1);

echo "Testing panchang management...\n";

try {
    // Test database connection
    require_once '../config/database.php';
    $pdo = getDBConnection();
    echo "Database connection: OK\n";
    
    // Test if panchang_data table exists
    $stmt = $pdo->prepare("SHOW TABLES LIKE 'panchang_data'");
    $stmt->execute();
    $table = $stmt->fetch();
    
    if ($table) {
        echo "panchang_data table: EXISTS\n";
        
        // Test table structure
        $stmt = $pdo->prepare("DESCRIBE panchang_data");
        $stmt->execute();
        $columns = $stmt->fetchAll(PDO::FETCH_ASSOC);
        echo "Table columns: " . count($columns) . "\n";
        
        // Test data count
        $stmt = $pdo->prepare("SELECT COUNT(*) as count FROM panchang_data");
        $stmt->execute();
        $count = $stmt->fetch(PDO::FETCH_ASSOC);
        echo "Data count: " . $count['count'] . "\n";
        
    } else {
        echo "panchang_data table: NOT FOUND\n";
    }
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
    echo "File: " . $e->getFile() . "\n";
    echo "Line: " . $e->getLine() . "\n";
}

echo "Test completed.\n";
?>
