<?php if($userinfo->num_rows == 0)
echo ("<p style='color: #f00;'>No users in this department<p>");
else{
$x = 0;
echo '<ul class="thumbnails">';
while($userDetail = $userinfo->fetch_assoc()){
$x ++;
echo '
<li class="span3">
<div class="thumbnail">
<a href="#" data-toggle="modal" data-target="#user'.$x.'"><img class="default" src="'.$userDetail['photo'].'" alt="" /></a>
<div class="caption">
<h5>'.$userDetail['first'].' '.$userDetail['last'].'</h5>
<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#user'.$x.'">View Details</a></p>
</div>
</div>
</li>
(other code)
This is a bootstrap thumbnail. I need PHP to count 4 users in one row and then star ta new row of users. How can I do this?
You can use the modulus to find out if the current thumbnail is the last in a row of four:
You can use this result to insert additional markup that ends the current row and starts a new one.