Hi all,

I have a loop that I want to show all users and info from a DB. After each user is displayed I need a divider line placed between them. The divider line is simply "div class="divider"></div>" with a 2X2 pixel, repeat X background image.

I have tried inserting this everywhere and am getting various results. I even tried closing the table and placing it after that but I get separate tables for each displayed user which isn't the result I am looking for.

This is the code above doctype:

$sql = "SELECT * FROM users ORDER BY userlevel DESC, username " . $pager->limit;
      $result = $db->query($sql);
      
      $display = '';
      while ($row = $db->fetch($result)) {
          $uname = $row['username'];
          $ulevel = $row['userlevel'];
          $email = $row['email'];
		  $office = $row['office'];
		  $fname = $row['fname'];
		  $lname = $row['lname'];
          $time = date("M-d-Y H:i", $row['timestamp']);
		  $avatar = $row['avatar'];
		  $inactive = $row['token'] != 0; 
		  
          if ($ulevel == '1' && !$inactive) {
          $display .= "<tr id=\"item_" . $row['id'] . "\">"
		  ." <td><img src=\"avatars/thumbs/".((is_null($avatar))?('default.jpg'):($avatar)). "\"class=\"thumb\" alt=\"Avatar\" /><br/>" . $uname . "</td>"
		  ." <td>" . $fname . "&nbsp;" . $lname ."<br/>Office:&nbsp;" . $office . "<br/><br/><br/><a href=\"user_profile.php?view_profile=$uname\">See agents profile here</a></td>"
		  ." <td>" . $bio . "</td>"
		  ." </tr>"
		  ."<tr><div class=\"divider\"></div></tr>\n";
		  
          
          $display .= "<tr id=\"editUserRow_" . $row['id'] . "\" style=\"display:none\">
      <td>&nbsp;</td>"
		  
          ." </tr>\n";
      }
	  }

Code between body tags:

<table class="list_of_agents_wrapper">
          <tr>
            <!--<th class="agents_text">Agents</th>
            <th></th>
            <th></th>-->
          </tr>
          <tr>
            <td>&nbsp;
            </td>
          </tr>
          <?php echo  displayUsers(); ?>
          </table>

Thanks for any help on this in advance....

Recommended Answers

All 2 Replies

Change

<tr><div class=\"divider\"></div></tr>

to

<tr><td colspan=\"3\"><div class=\"divider\"></div></td></tr>

I see...so the td needed a bit of info to display this div. Thank you big time for this. I can start living again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.