I’ve got the following:
<table border="1">
<?php
$i = 0;
$tmp = 1;
foreach ($recip['Data']['Recipes'] as $key => $recipe) {
$tmp = $i % 2;
echo $tmp;
if($tmp == 0) {
echo '<tr>';
}
echo '<td>
<a href="/recipe_search.php?id=' . $recipe['ID'] . '">';
echo $recipe['TITLE'];
echo '</a> </td>';
if($tmp == 0){
echo '</tr>';
}
$i = $i + 1;
}
?>
</table>
What I want is, that, two values are in one row. So if $tmp is even, a new row should be started. Unfortunately, the code does not do that, every value stands in a new row.
How can I manage this?
1 Answer