i'll let you look at the asp version bc im not sure of the syntax for php but the theory is the same
Code:
'varialbes
const intNoPerRow = 2
dim intCatCount
dim intTotCats
<% if not rsStore.eof then %>
^^- if there are records in the database continue running script
<table width="100%" border="0" cellpadding="3" cellspacing="3">
<tr>
<%
'loop for getting all records from database
do while not rsStore.eof
%>
<td><div align="center">this is the stuff that will be repeated across page</div></td>
<%
intCatCount = intCatCount + 1
intcatcount stores the number of columns in the current row
if intCatCount = intNoPerRow then
check if we are at our max per row now, if we are start new row
%>
</tr><tr>
<%
intCatCount = 0
'reset counter for columns
end if
rsstore.movenext
loop
%>
</table>
<%end if%>
the <% is the same as your <?php and %> is the php close tag