richardjh: Don't worry or apologize. You are pretty close.
Something like the following might work for you:
<?php
$query = "SELECT * FROM table_name ORDER by sid";
$result = mysql_query($query) or die(mysql_error());
// make sure there are images (you can handle this any way you like)
if(mysql_num_rows($result) < 1) { die('no images..'); }
// ok, there are images, create your table...
echo '<table cellpadding="5" cellspacing="0" border="1">'."\n";
$counter = 1;
while($row = mysql_fetch_array( $result ))
{
if($counter == 1)
{
echo '<tr>' . "\n";
}
echo '<td>' . "\n";
echo '<img src="' . $row['image'] . '" border="0" alt="image" />' . "\n";
echo '</td>' . "\n";
if($counter == 3)
{
echo '</tr><tr>' . "\n";
$counter = 1;
}
else { $counter++; }
}
echo '</table>' . "\n";
?>
This can be expanded almost infinitely to meet your exact needs, but hopefully shows you how you can echo out the values you are retrieving from the DB directly. If you DO want to store the images into a variable, the best option here is to use an array, like:
<?php
$query = "SELECT * FROM table_name ORDER by sid";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result) < 1) { die('no images..'); }
// create array of images:
$images = array();
while($row = mysql_fetch_array( $result ))
{
// add each image to your array:
$images[] = $row['image'];
}
?>
Then, to output values from your images array, use a foreach() loop...