I don't understand the problem,
but in your code I can find this probabily mistakes:
1- after while there isn't a { } block. So the only one istruction executed other than $images=... is print_r().
2- for($i=0;$i<$count;$i+=3): there you write 3 instead of $max.
3- if ($j == $max-1) is before the main if. Put it before, because you are closing the line...
(you now get
<tr><td>"some td"</td></tr><td>the ast td</td>
instead of
<tr><td>"some td"</td><td>the ast td</td></tr>)
However try this code, maybe this work fine...
see you
<?
if($count = mysql_num_rows($result) > 0) {
$max=3; $count=mysql_num_rows($result);
echo "<table border=1><tr>";
for($i=0;$i<$max;$i++)
{
echo "<td>Column $i+1</td>";
}
echo "</tr>\n";
for($i=0;$i<$count;$i+=$max) /* loop through and build the table */
{
$headings = $pics = $locations = '<tr>';
for($j=0;$j<$max;$j++)
{
if($images = mysql_fetch_assoc($result))
{
$headings .= '<td>' .$images['heading_column']. '</td>';
$pics .= '<td><img src="' .$images['smallpic']. '"></td>';
$locations .= '<td>' .$images['Price']. '</td>';
} else {
$headings .= '<td> </td>';
$pics .= '<td> </td>';
$locations .= '<td> </td>';
}
}
$headings .= "</tr>\n";
$pics .= "</tr>\n";
$locations .= "</tr>\n";
echo $headings;
echo $pics;
echo $locations;
}
echo '</table>';
}
?>