Hello everyone!! I am sorry for my english. I hope you could understand.
More or less I want to display like a this table but I have a problem. My table has got 5 colums(tds) and 3 rows(tr) that takes data from mysql database.
I use foreach and i can get the data. But when I want to display like I told before, 5 colums and 3 rows, my css layout change, getting all data in one row. How could I display this kind of data ? What I want is that when fills 5 colums, get the next row.
Thank You Very Much
Could you post the code with the foreach that displays the data?
Hello! Thank you for answering my question. I couldn´t answer before.
I have this code but it doesn´t work at all.
<table>
<?php
$cols=5;
$rows=3;
foreach ($jokes as $joke): ?>
<?php
$ordu=htmlspecialchars($joke[‘ordu’],ENT_QUOTES, ‘UTF-8’);
$id_erretserba= htmlspecialchars($joke[‘id_erretserba’],ENT_QUOTES, ‘UTF-8’);
$zelan= htmlspecialchars($joke[‘zelan’],ENT_QUOTES, ‘UTF-8’);
$erabi_izena=htmlspecialchars($joke[‘erabi_izena’],ENT_QUOTES, ‘UTF-8’);
$eguna=htmlspecialchars($joke[‘eguna’],ENT_QUOTES, ‘UTF-8’);
$ordua=htmlspecialchars($joke[‘ordua’],ENT_QUOTES, ‘UTF-8’);
$od=htmlspecialchars($joke[‘ordua’],ENT_QUOTES, ‘UTF-8’);
$merabil=htmlspecialchars($joke[‘merabil’],ENT_QUOTES, ‘UTF-8’);
?>
<?php
for ($i=1; $i<=$rows; $i++) {
echo ‘<tr>’;
for ($i=1; $i<=$cols; $i++) {
?>
<td>
<img src=“arg/lauki_berde.jpg” />
<div class=“orduak_okupazioa08”>
<div class=“orduak_okupazioa_1”><?php echo $ordua; ?></div>
<div class=“orduak_okupazioa_2”>libre</div>
</div>
<div class=“orduak_okupazioa_nork08”>Libre</div>
</td>
<?php
}
echo ‘</tr>’;
}
?>
<?php endforeach;?>
</table>
Are use a framework ??
Ok you can change $i in one of your loops
for ($r=1; $r<=$rows; $r++) {
Thank you very much for answering.
I wan´t using framework and I changed the variable but it couldn´t work.
At the end, I got it but not this way. Using a different arrays.
Thank you very much!