<?php
error_reporting(E_ERROR | E_PARSE);
include '../conector.php';

echo "=== Test query con per2=10 (Periodo 2) ===\n";
$select_periodos="select a.anno as a_anno, a.periodo as a_periodo, b.periodo as b_periodo, b.id as b_id
                from planilla a, planilla b 
                where a.id=10 
                and a.anno=b.anno
                and b.periodo < a.periodo
                order by b.periodo";

$res = mysql_query($select_periodos);
echo "Resultados: " . mysql_num_rows($res) . "\n";
while($row = mysql_fetch_assoc($res)){
    print_r($row);
}

echo "\n=== Test query con per2=11 (Periodo 3) ===\n";
$select_periodos2="select a.anno as a_anno, a.periodo as a_periodo, b.periodo as b_periodo, b.id as b_id
                from planilla a, planilla b 
                where a.id=11 
                and a.anno=b.anno
                and b.periodo < a.periodo
                order by b.periodo";

$res2 = mysql_query($select_periodos2);
echo "Resultados: " . mysql_num_rows($res2) . "\n";
while($row2 = mysql_fetch_assoc($res2)){
    print_r($row2);
}

echo "\n=== Test query con per2=15 (Periodo 4) ===\n";
$select_periodos3="select a.anno as a_anno, a.periodo as a_periodo, b.periodo as b_periodo, b.id as b_id
                from planilla a, planilla b 
                where a.id=15 
                and a.anno=b.anno
                and b.periodo < a.periodo
                order by b.periodo";

$res3 = mysql_query($select_periodos3);
echo "Resultados: " . mysql_num_rows($res3) . "\n";
while($row3 = mysql_fetch_assoc($res3)){
    print_r($row3);
}
?>