scaffolding for bootstrap columns in php while loops

Saturday, October 17, 2015

I'm trying to present my sql rows in bootstrap grid dynamically

sql row 1
sql row 2
sql row 3
sql row 4
</div>
sql row 5
sql row 6
sql row 7
sql row 8
</div>

and I'm having trouble how to set up the while loop. what I have now just does

sql row 1
sql row 2
sql row 3
sql row 4
sql row 5
sql row 6
sql row 7
sql row 8
</div>

how can I set up loop to assign four col-md-3 classes to each row automatically and then continue. Current code:

while($row = $result->fetch_assoc()) { $spons_amt = round($row["spons_amt"] + 500, 2); echo '
' . $spons_amt . '
' } mysqli_close($conn); </div>

I'm guessing what I need to do is

        
while($row = $result->fetch_assoc()) // count number of rows { //list 4 of these (to make a row) $spons_amt = round($row["spons_amt"] + 500, 2); echo '
' . $spons_amt . '
' } // echo </div>
between every set of 4 mysqli_close($conn);

Am I going about this the right way? How could I complete the code?


Filed under: php
     

0 comments:

Post a Comment