http://racresearch.com/
Regards
Joe
Moderator: General Moderators
Code: Select all
<?php
for($x = 0, $y = count($images); $x < $y; $x++)
{
if($x % 6 == 0)
echo '<tr>';
echo '<td><img src="'.$images[$x].'" /></td>';
if($x % 6 == 5)
echo '</tr>';
}
$y = ($y + 5) % 6;
if($y != 5)
echo '<td colspan="'.($y+1).'">&'.'nbsp;</td></tr>';
?>Code: Select all
<table width="342" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php
$image[] = 'image1.jpg';
$image[] = 'image2.jpg';
$image[] = 'image3.jpg';
$image[] = 'image4.jpg';
$image[] = 'image5.jpg';
$image[] = 'image6.jpg';
$image[] = 'image7.jpg';
$image[] = 'image8.jpg';
$image[] = 'image9.jpg';
$image[] = 'image10.jpg';
$image[] = 'image11.jpg';
$image[] = 'image12.jpg';
$image[] = 'image13.jpg';
$image[] = 'image14.jpg';
$image[] = 'image15.jpg';
$cols = 6;
$num_pics = count($image) -1;
$i = 0;
while ( $i <= $num_pics )
{
$newrow = $i > 0 && (!($i % $cols)) ? " </tr>\n <tr>\n" : '';
echo $newrow;
echo " <td><img src="{$image[$i]}"></td>\n";
$i++;
}
while ($i % $cols)
{
echo " <td>&", "nbsp;</td>\n"; // done like that to stop the forum pasring the HTML entity
$i++;
}
?>
</tr>
</table>Code: Select all
<table width="342" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="image1.jpg"></td>
<td><img src="image2.jpg"></td>
<td><img src="image3.jpg"></td>
<td><img src="image4.jpg"></td>
<td><img src="image5.jpg"></td>
<td><img src="image6.jpg"></td>
</tr>
<tr>
<td><img src="image7.jpg"></td>
<td><img src="image8.jpg"></td>
<td><img src="image9.jpg"></td>
<td><img src="image10.jpg"></td>
<td><img src="image11.jpg"></td>
<td><img src="image12.jpg"></td>
</tr>
<tr>
<td><img src="image13.jpg"></td>
<td><img src="image14.jpg"></td>
<td><img src="image15.jpg"></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>Code: Select all
<?php
$link = mysql_connect("???", "????", "???");
mysql_select_db("???") or die("Could not connect!" . mysql_error());
$sql = "SELECT * FROM images";
$result = mysql_query($sql) or die("Error!");
while (true)
{
$row = mysql_fetch_assoc($result);
if ($row == false) break;
$images = $row['image'];
}
for($x = 0, $y = count($images); $x < $y; $x++)
{
if($x % 6 == 0)
echo '<tr>';
echo '<td><img src="'.$images[$x].'" /></td>';
if($x % 6 == 5)
echo '</tr>';
}
$y = ($y + 5) % 6;
if($y != 5)
echo '<td colspan=".($y+1)."> </td></tr>';
?>Code: Select all
$images = $row['image'];Code: Select all
$images[] = $row['image'];