简体   繁体   中英

How can I create a for/while loop for following product formation?

I am using database for retrieving products.

I want to display product in following pattern.

What can be the php Or .net loop code for this ? Help.

<div class="big-row">
        <div class="first-row-left">
            <div class="product-1a">Product1</div>
            <div class="product-1a">Product2</div>
            <div class="product-1a">Product3</div>
            <div class="product-1b">Product4</div>
            <div class="product-1b">Product5</div>
            <div class="product-1b">Product6</div>
        </div>
        <div class="first-row-right">
            <div class="bigproduct-right">Product7</div>
        </div>
    </div>
    <div class="single-row">
        <div class="product-single-row">Product8</div>
        <div class="product-single-row">Product9</div>
        <div class="product-single-row">Product10</div>
        <div class="product-single-row">Product11</div>
        <div class="product-single-row">Product12</div>
    </div>
<div class="big-row">
        <div class="first-row-left">
     <?php    
        for($i = 0, $intSize = sizeof($arr); $i < $intSize ; $i++){ 
     ?>         <div class="product-1a"><?php echo $arr['product']; ?></div>
     <?php 
         }
     ?> 
         </div>

A small example of for loop

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM