Estoy creando un sitio web que utiliza reportes en pdf, para poder mostrarlos estoy utilizando la libreria fpdf de PHP, cuando intento hacer una consulta a la tabla de equipos de prueba en lugar de mostrarme los campos una vez como es lo normal los muestra dos veces, si hay alguien que pueda ver el error que estoy cometiendo seria de mucha ayuda, solo muestra 12 porque los demas estan recortados, sino estos se saldrian de la pagina.
function escribirCeldas(){
include('db_con.php');
$zona=$_SESSION["zona"];
$w = 23;
$h = 5;
$query="select * from ".$zona."_equipos_de_prueba";
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
$total_row = $statement->rowCount();
if($total_row > 0)
{
foreach($result as $row)
{
$nummaxlin = 1;
$te = 0;
foreach($row as $cell){
if($te<12){
$te++;
if($this->GetStringWidth($cell)<$w){
$numl = 1;
}
else{
$numl = $this->encLin($w,$cell);
}
if($numl>$nummaxlin){
$nummaxlin=$numl;
}
}
}
$te = 0;
foreach($row as $cell){
if($te<12){
$te++;
if($this->GetStringWidth($cell)<$w){
$this->Cell($w,($nummaxlin*$h),$cell,1,0);
}
else{
if($this->GetStringWidth($cell)<($w*($nummaxlin-1))){
$xPos = $this->GetX();
$yPos = $this->GetY();
$numl = $this->encLin($w,$cell);
$alt=($h*($nummaxlin/$numl));
$this->MultiCell($w,$alt,$cell,1);
$this->SetXY($xPos + $w, $yPos);
}
else{
$xPos = $this->GetX();
$yPos = $this->GetY();
$this->MultiCell($w,$h,$cell,1);
$this->SetXY($xPos + $w, $yPos);
}
}
}
}
$this->Ln($nummaxlin*$h);
}
}
else
{
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Cell($w,$h,'N/A','LR',0,'L',false);
$this->Ln();
}
}
En lugar mostrarme los 12 campos que debería me muestra 24. He revisado el codigo varias veces pero en verdad no encuentro nada verdaderamente raro, lo unico que podria llegar a pensar es que es un error de fpdf pero solo seria intentar buscar una respuesta facil.