<?php
ini_set('display_errors', '1');
error_reporting(E_ALL);

require_once dirname(__FILE__) . '/../config.php';

try {
    $db = getDB();
    
    // Test tabla productos
    $s = $db->query('SELECT COUNT(*) as c FROM productos WHERE puv = 1');
    $r = $s->fetch();
    echo "productos OK: " . $r['c'] . "\n";
    
    // Test tabla promod
    $s = $db->query('SELECT COUNT(*) as c FROM promod WHERE tipo_promo = 7 AND activa = 1');
    $r = $s->fetch();
    echo "promod OK: " . $r['c'] . "\n";
    
    // Test tabla banco
    $s = $db->query('SELECT COUNT(*) as c FROM banco');
    $r = $s->fetch();
    echo "banco OK: " . $r['c'] . "\n";
    
    echo "ALL OK";
} catch (Exception $e) {
    echo "ERROR: " . $e->getMessage();
}
