$query = "SELECT thumb, popup FROM Web_images WHERE brand= '$brand' ORDER BY id" ;
$result = mysql_query($query) or die ("Error in query: $query. " .
mysql_error());
// count number of rows in database
$row_count = mysql_num_rows($result);
echo "<table>\n";
while($row = mysql_fetch_array($result)){
echo "<tr><td>". $row['thumb']." ".$row['popup']."</td></tr>\n";
}
echo "</table>\n";
?>
produces a one-column html table like this:
<table>
<tr><td>Timage1 Pimage1</td></tr>
<tr><td>Timage2 Pimage2</td></tr>
<tr><td>Timage3 Pimage3</td></tr>
<tr><td>Timage4 Pimage4</td></tr>
<tr><td>Timage5 Pimage5</td></tr>
<tr><td>Timage6 Pimage6</td></tr>
etc
</table>
But I need to have 6 columns, not one - so that I get this result:
<tr>
<td>Timage1 Pimage1</td>
<td>Timage2 Pimage2</td>
<td>Timage3 Pimage3</td>
<td>Timage4 Pimage4</td>
<td>Timage5 Pimage5</td>
<td>Timage6 Pimage6</td>
</tr>
<tr>
<td>Timage7 Pimage7</td>
etc
As I see it the cells need to be called up in blocks of six - with each <td> having a successive pair of database cells. So far my attempts have resulted blocks of six with the same pair, rather than successive pair of images. Can anybody help?