Gracias, por responder, mira mi código esta así:
Aqui cargo un array 'cargos' que me determinará el número de tablas que se generarán:
Código PHP:
$SqlCargos="SELECT CODI_CARGO, (Select desc_cargo from cargo_empl c where c.codi_cargo=e.codi_cargo) FROM EMPLEADOS e WHERE ESTA_EMPLE='A' AND CODI_LOCAL = '".$local."' GROUP BY CODI_CARGO ORDER BY CODI_CARGO ASC;";
$resultCargo=mysql_query($SqlCargos,$link);
$t=0;
while($registro=mysql_fetch_array($resultCargo))
{
$cargo[$t]=$registro[0];
$nomb_cargo[$t]=$registro[1];
$t++;
}
aqui hago una consulta que me devuelve los datos para poder generar la tabla:
Código PHP:
for($j=0; $j<count($cargo); $j++){
$SQL="SELECT * FROM (
SELECT NUM_ITEM,ANIO,MES,NUM_PERSONAS,CODI_CARGO,CODI_LOCAL,
(SELECT DESC_CARGO FROM CARGO_EMPL C WHERE C.CODI_CARGO=S.CODI_CARGO) AS NOM_CARGO
FROM SALIDAS S WHERE CODI_LOCAL='".$local."' AND CODI_CARGO='".$cargo[$j]."'
ORDER BY ANIO DESC,MES DESC
LIMIT 0,6
) AS TempTable
ORDER BY TempTable.anio ASC, TempTable.mes ASC;";
$result=mysql_query($SQL,$link)or(die ("Error Base de Datos: ". mysql_error()));
$constante=array(1,2,3,4,5,6);
$i=0;
//$salidas=array(6);
while($registro = mysql_fetch_array($result))
{
echo "<br>";
echo "<table border = '1' cellspacing='0' cellpadding='1' bordercolor='#999999' align='center'> \n";
echo "<tr> \n";
echo "<td width=60 class=Estilo16><b><center>Año</center></b></td> \n";
echo "<td width=65 class=Estilo16><b><center>Mes</center></b></td> \n";
echo "<td width=50 class=Estilo16><b><center>Salidas</center></b></td> \n";
//echo "<td width=50 class=Estilo16><b><center>num_item</center></b></td> \n";
echo "</tr> \n";
do {
$num_item=$registro[0];
$anio=$registro[1];
$mes=$registro[2];
$num_personas=$registro[3];
$c_cargo=$registro[4];
$local=$registro[5];
$nom_cargo=$registro[6];
$salidas[$i]=$num_personas;
$i++;
if($mes==1){$nomMes="Enero";}
if($mes==2){$nomMes="Febrero";}
if($mes==3){$nomMes="Marzo";}
if($mes==4){$nomMes="Abril";}
if($mes==5){$nomMes="Mayo";}
if($mes==6){$nomMes="Junio";}
if($mes==7){$nomMes="Julio";}
if($mes==8){$nomMes="Agosto";}
if($mes==9){$nomMes="Septiembre";}
if($mes==10){$nomMes="Octubre";}
if($mes==11){$nomMes="Noviembre";}
if($mes==12){$nomMes="Diciembre";}
echo "<tr> \n";
echo "<td><center>".$anio."</center></td>\n";
echo "<td><center>".$nomMes."</center></td>\n";
echo "<td><center>".$num_personas."</center></td>\n";
echo "</tr> \n";
} while ($registro = mysql_fetch_array($result));
echo "</table> \n";
}mysql_free_result($result);
$datos = (regresion_lineal($constante, $salidas));
$tendencia=$datos["m"] + $datos["b"];
$tendencia=round($tendencia,4);
echo "<table border = '1' cellspacing='0' cellpadding='1' bordercolor='#999999' align='center'> \n";
echo "<tr> \n";
echo "<td width=110 class=Estilo15><b><center>Proyección ".$nom_cargo.": </center></b></td> \n";
echo "<td width=75 class=Estilo17><b><center>$tendencia</center></b></td> \n";
echo "</tr> \n";
echo "</table> \n";
}
todos estos calculos funcionan y las tablas se me genran correctamente, pero se van creando una tras de otra y con el scroll toca estar de arriba a abajo, y me gustaria distribuir las tablas de mejor manera.