I have the following array
$arreglo=[1,2,3,4,5..50]
I want to show them in a table, but that the table is of 10 columns type like this:
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
etc...
The number of rows depends on the size of the array divided by 10, rounded to the largest, for example, if I have 25 data in the array (hence 25 positions) then the number of rows would be 3, I have this code, but I shows only the top 10 positions and not the rest
for($j = 0; $j < $rows;){
$html2.='<tr>';
for($k = 0;$k < 10; $k++){
$html2.='<td style="border: 1px solid #666;">Caja#'.($j+1).'<br>'.$datos[$j].'</td>';
$j++;
if($j==$tama){ //Si el dato no tiene las 10 cajas minimas para el for
break;
}
}
$html2.='</tr>';
I have for example I have 12 boxes
but when it comes to wanting to show them, it shows me only 10
How can I resolve the error in that code?