Lamez Posted March 25, 2008 Share Posted March 25, 2008 I need help bad, I have been at this for hours, and I am getting no luck. Here is how I need help. I have table that pulls out all the user picks, username, and total points. here is how I want it: Username | Lamez | Anotheruser | MyUsername | tester | -------------------------------------------------------------- 2nd Round| TeamA | Team B | Team C | TeamD| -------------------------------------------------------------- |Team D | TeamG | Team AD | TeamL| -------------------------------------------------------------- |Team H | TeamY | Team N |TeamM| -------------------------------------------------------------- and so on, but It does not look like that, I do not think I am putting my loop in the right place, could someone guide me where to put my other loop. here is what I have so far: <?php include ("../../style/include/session.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $user = mysql_query("SELECT username FROM users"); $r = mysql_query("SELECT * FROM rnd1 WHERE username = '$user'"); $rnd1 = mysql_fetch_array($r); $rto = mysql_query("SELECT * FROM userpoints WHERE username = '$user'"); ?> <table width="604" border="1"> <tr> <td width="76">Username</td> <?php while($username = mysql_fetch_array($user)){ ?> <td width="190"><?php echo $username['username']; ?></td> <td width="316"> </td> <?php } ?> </tr> <tr> <td>2nd Round </td> <td><?php echo $rnd1['a1']; ?></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </body> </html> -Thanks Guys Quote Link to comment https://forums.phpfreaks.com/topic/97737-loops-and-tables/ Share on other sites More sharing options...
wildteen88 Posted March 25, 2008 Share Posted March 25, 2008 You'll be better of using an SQL Join rather than doing three different queries Quote Link to comment https://forums.phpfreaks.com/topic/97737-loops-and-tables/#findComment-500254 Share on other sites More sharing options...
Lamez Posted March 25, 2008 Author Share Posted March 25, 2008 how would I do that? ??? Quote Link to comment https://forums.phpfreaks.com/topic/97737-loops-and-tables/#findComment-500272 Share on other sites More sharing options...
wildteen88 Posted March 25, 2008 Share Posted March 25, 2008 Have a read up on SQL Joins (advanced) or beginner. Quote Link to comment https://forums.phpfreaks.com/topic/97737-loops-and-tables/#findComment-500457 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.