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

$per2 = 9;
$cur2 = 12;

echo "Test query:\n";

$select_periodos="select a.anno,b.periodo,b.id,a.periodo
                from planilla a,planilla b 
                where a.id=".$per2." 
                and a.anno=b.anno
                and b.periodo<a.periodo
                order by b.periodo";

echo $select_periodos . "\n\n";

$res = mysql_query($select_periodos);
if(!$res){
    echo "Error: " . mysql_error() . "\n";
} else {
    echo "Success: " . mysql_num_rows($res) . " rows\n";
}
?>