I’m going to get a headache from this one. I have a simple query and a simple table I generate during the query’s while loop. I want to create a new row after each third result.
$customers_num=8; // This is actually mysql_numrows($result) never mind;
$i=0;
while ($i < $customers_num) {
if($i % 3 === 0) {
print '<tr>';
}
print '<td style="width: 30%;"></td>';
if($i % 3 === 0) {
print '</tr>';
}
$i++;
}
If the question is not clear, because of my English, I could try to improve the question to bee more precise.
The problem is that I close the <tr> right after I open it :S I need to open it, put three TD’s into it, and then close it…
First of all, you forgot to increment
$i. This should do the trick: