mysql - php select records from database -


need :

i have 4 columns in css/html, , need show records database (100 records) based on id number ( or sorted rows) following configuration :

column1.......column2......column3......column4

....id-1..............id-2..............id-3...............id-4

....id-5..............id-6..............id-7...............id-8

....id-9..............id-10............id-11..............id-12

....id-13.............id-14...........id-15.............id-16

and on.

from 100 records, every column have 25 rows respectively.

the problems comes rule column1 should first filled out, continued next column.

how can use php if condition rule?

i have tried , found confused :

 <?php               $row=0;              foreach ($ads $ad) {               $row++;              if (($row==1) or ($row%4==0)) {              ?>             <div  style="border: 1px solid #ddd; width: 200px; font-size: 10px; line-height: normal; padding: 3px; text-align: justify; margin-left: 5px; margin-bottom: 3px; background-color: #ffe">                 <a href="#"><?php echo $ad['id']; ?>. <?php echo $ad['adds']; ?> </a><br>                 <span ><strong>contact: <?php echo $ad['phone1']; ?>, <?php echo $ad['phone2']; ?>, <?php echo $ad['phone3']; ?></strong></span>             </div>             <?php              $row=0;             }} ?> 

i need select record number 1, 5, 7, 13 , on. continue second column.

i need select record number 1, 5, 7, 13 , on.

why don't use for loop , increment iteration variable number of columns on every iteration?

for ($i = 0; $i < 100; $i += 4) {     $ad = $ads[$i];     // print cell } 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -