<?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)
这是一个引导缩略图。我需要 PHP 在一行中计算 4 个用户,然后开始新的一行用户。我怎样才能做到这一点?