twitter bootstrap - PHP split while loop into 3 columns to avoid page break -
i using php while loop review data database. however, when reviews longer 1 line breaks grid system (i using bootstrap 3) , page looks messy. have thought 2 solutions, read more button , show fixed height of boxes. alternatively, split data received database 3 columns not break page.
preferably split data loop shows data in 3 columns.
this while loop fetches data:
<?php while($row = mysqli_fetch_array($result)) { $data = mysqli_fetch_array(mysqli_query($con, "select first_name, last_name transactions order_id = '{$row['order_id']}'")); $name = $data['first_name']. ' '. mb_substr($data['last_name'], 0, 1); if($row['rating'] == 5) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span>'; if($row['rating'] == 4) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span>'; if($row['rating'] == 3) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span>'; if($row['rating'] == 2) $star = '<span class="glyphicon glyphicon-star review_star"></span><span class="glyphicon glyphicon-star review_star"></span>'; if($row['rating'] == 1) $star = '<span class="glyphicon glyphicon-star review_star"></span>'; ?> <div class="col-md-4"> <div id="box_review"> <h3><?php echo $star; ?></h3> <h5 class="thin"><?php echo $row['date'] ?></h5> <blockquote> <p><?php echo $row['comment'] ?></p> <footer><?php echo $name ?></footer> </blockquote> </div> </div> <?php } ?>
Comments
Post a Comment