I have a query of MySQL
in which there may be x number of communications radios stored there, the table prints perfect if I do it without the counter, but as it is necessary to know how many radios there are according to the query, I need that in the first box the counter comes out, that is, if there are 10 radios that come out 1, 2, 3 ... 10
First I capture how many radios there are according to the location and it is really fine because I already printed the variable $total
and if there are 15 radios, I printed 15, here is the code:
//averiguo cuantos radios hay
$total = mysql_num_rows(mysql_query("SELECT * FROM dispositivos WHERE localizacion ='$localizacion_seleccionada'"));
/*
esto es lo que intenté, pero al momento de imprimir, si hay 13 radios efectivamente me sale 1,2,3... hasta el 13 y vuelve a empezar, es decir imprime los 13 radios una y otra vez
*/
while($resultado = mysql_fetch_array($consulta))
{
for ($i=1; $i < $total; $i++)
{
$pdf->Cell(20,10,$i,1,0,'C'); // en esta casilla numero del radio
$pdf->Cell(20,10,$resultado['marca'],1,0,'C');
$pdf->Cell(20,10,$resultado['tipo'],1,0,'C');
$pdf->Cell(15,10,$resultado['id'],1,0,'C');
$pdf->Cell(22,10,$resultado['serie'],1,0,'C');
$pdf->Cell(25,10,$resultado['modelo'],1,0,'C');
$pdf->Cell(10,10,$resultado['frecuencia'],1,0,'C');
$pdf->Cell(7,10,$resultado['bateria'],1,0,'C');
$pdf->Cell(7,10,$resultado['antena'],1,0,'C');
$pdf->Cell(7,10,$resultado['gancho'],1,0,'C');
$pdf->Cell(7,10,$resultado['cargador'],1,0,'C');
$pdf->Cell(7,10,$resultado['fuente'],1,0,'C');
$pdf->Cell(130,10,$resultado['comentarios'],1,0,'C');
$pdf->Ln();
}
}