Create a new row of tables?

Hi All,

I am creating a web application where people can set up their own online stores. What you see in the picture is just my test store, yes, the items are a bit crazy.

I have it all pretty much working apart from this problem:

Sometimes it helps to show people a picture so they understand my problem better:
http://tinypic.com/r/16jg7ja/7

As you can see I am displaying items in their own seperate tables, within a table. I would like to keep it like this and have not done it by mistake.

My problem is that if I have lot’s of items they will just run in a never ending horizontal line, could somebody please help me make it so that after a certain amount of results it starts a new line instead of it being just one big one? If somebody could incorporate it with my current code that would be even better.

Here is my code:

[code]

<?php while($row = mysql_fetch_array($result)) { ?>
><?php echo $row['itemName'] ?>
<?php echo $row['itemPrice'] ?>
<?php } ?>
[/code]

I am willing to give away A free copy of my finished product to anybody who I feel has helped.

Thanks,
PHPJordan.

Hey…
Hope this does the trick:
[php]

<?php //SET MAX PER ROW HERE: $max_number_per_row = 4; ?> <?php while($row = mysql_fetch_array($result)) {

if($n <= $max_number_per_row) {
?>

<?php $n++; }else{ $n = 0; ?> <?php $n++; } } ?>
   </table>

[/php]

Cheers
Ramanakumar

><?php echo $row['itemName'] ?>
<?php echo $row['itemPrice'] ?>
><?php echo $row['itemName'] ?>
<?php echo $row['itemPrice'] ?>

Try with this, change $maxItemLine to change Items in the same row

[php]

<?php $cont = 0; $maxItemLine = 4; while($row = mysql_fetch_array($result)) { if($cont%$maxItemLine==0){ echo""; } ?> "; } } if($cont%$maxItemLine!=0){ echo""; }

?>

><?php echo $row['itemName'] ?>
<?php echo $row['itemPrice'] ?>
<?php $cont ++; if($cont%$maxItemLine==0){ echo"
[/php]

Tahnk you both for your help! When my product is launched you can both have a free copy if you’d like! :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service