Jump to content

while loop not echo'ing multiple results(repeating itself)


newb

Recommended Posts

im having a bit of trouple with the while loop...its probably an easy fix, just cant figure it out atm.

[code]
<?php
$query = $libmysql->query("SELECT * from $table_users ORDER by username ASC");
echo "<table width='100%' align='center'>
  <tr>
    <td colspan='4' valign='top' id='navcontent'>$links</td>
  </tr>
  <tr>
    <td colspan='4' valign='top'><strong>Member List </strong></td>
  </tr>
  <tr>
    <td valign='top'><strong>Name</strong></td>
    <td valign='top'><strong>Usergroup</strong></td>
    <td valign='top'><strong>Registration Date </strong></td>
    <td valign='top'><strong>Email</strong></td>
  </tr>";
while ($row = $libmysql->fetch_array($query)) {
$i++;
$user = $row['username'];
$signup_date = $row['signup_date'];
$email = $row['email'];
$tempsid = $row['sid'];
$query = $libmysql->query("SELECT * FROM $table_usergroups WHERE id = '$tempsid'");
$row = $libmysql->fetch_array($query);
$custom_title = $row['custom_title'];
$libmysql->free_result($query);
echo "<tr>
<td width='35%' valign='top'>$user</td>
<td width='60%' valign='top'>$custom_title</td>
<td width='60%' valign='top'>$signup_date</td>
<td width='60%' valign='top'>$email</td>
  </tr>";
 
  if ( $i == 2 ) {
  echo "<tr><td width='35%' valign='top'>$user</td>
<td width='60%' valign='top'>$custom_title</td>
<td width='60%' valign='top'>$signup_date</td>
<td width='60%' valign='top'>$email</td>";
  $i = NULL;
}

echo '</tr></table>';
  }
?>[/code]

any suggestions?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.