newb Posted September 23, 2006 Share Posted September 23, 2006 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? Quote Link to comment Share on other sites More sharing options...
Orio Posted September 23, 2006 Share Posted September 23, 2006 Before the loop, add- $i=1.And instead of writing $i=NULL (in the end of the loop), write $i=1.Orio. Quote Link to comment Share on other sites More sharing options...
newb Posted September 23, 2006 Author Share Posted September 23, 2006 ok it echo's multiple tables but in each of the tables it repeats the same information....ie:John Doe - john@doe.comJohn Doe - john@doe.cominstead of :John Doe - john@doe.comOther John Doe - otherjohn@doe.com Quote Link to comment Share on other sites More sharing options...
Orio Posted September 23, 2006 Share Posted September 23, 2006 That's probbly because $libmysql->fetch_array() doesnt move the internal pointer.Why dont you use mysql_fetch_array($query) ?Orio. Quote Link to comment Share on other sites More sharing options...
newb Posted September 23, 2006 Author Share Posted September 23, 2006 i did, same effect. $libmysql->fetch_array is just a function i defined. Quote Link to comment Share on other sites More sharing options...
newb Posted September 23, 2006 Author Share Posted September 23, 2006 ok got it working thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.