Hi bpat,
Thanks for responding.
I follow the counter at the top to get the row quantities.
And I follow, partially, the loop, but I tried this and I replaces 'pic' with 'Image' the field name but I am not sure that's where you where heading with this.
When I do it the way I explained, I get...
Cell - Cell
1 - 'blank'
2 - 'blank'
and so on.
Here is the results from a a print_r...
Array
(
[0] => 11
[ID] => 11
[1] => Description goes here.
[Name] => Description goes here.
[2] => store1.gif
[Image] => store1.gif
[3] =>
[URL] =>
[4] => 11
[Listing] => 11
[5] => 1
[SiteEnabled] => 1
[6] =>
[Misc] =>
)
I know that I am off here, just not sure where. Here is my adaptation of your suggestion in my code...
<?
$conn = mysql_connect("x", "x", "x")
OR DIE (mysql_error());
@mysql_select_db ("abc", $conn) OR DIE (mysql_error());
$sql = "SELECT * FROM x WHERE SiteEnabled = 1 ORDER BY Listing";
$result = @mysql_query($sql, $conn) or die(mysql_error());
$row2 = mysql_query($sql, $conn);
// Define whats left and right for columns
$num = mysql_num_rows($result);
$left = ceil($num/2); // Get the left column
$right = $num-$left;
// Set up the array to hold the images
$items = array(); // Get all rows into array
while($row = mysql_fetch_array($result))
{
$items[] = $row;
}
?>
<table width="160" border="1" bordercolor="#666666">
<?PHP
$i=1;
foreach($items as $item)
{
$l = $i-1;
$r = $l+$left; // Get right start number (0+4 = 4... start at row 4 (5th image))
echo '<tr><td>'.$item[$l]['pic'].'</td><td>'.$item[$r]['pic'].'</td></tr>';
}
?>
</table>
<pre>
<?PHP print_r($item); ?>
</pre>
Thanks,
Don