shorty3 Posted April 29, 2010 Share Posted April 29, 2010 I have this code tht i coded yesterday but im slightly confused here it is <table width="275" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#000000" class=thinline> <tr> <td height="20" colspan="2" align="center" background="includes/grad.jpg">Top 10 Street Races</td> </tr> <tr> <td width="32" height="20" align="center" background="includes/gradgrey.jpg">No.#</td> <td width="153" height="20" align="center" background="includes/gradgrey.jpg">Username</td> </tr> <?php $tsel2 = mysql_query("SELECT * FROM `user_info` order by `races` desc limit 10"); $tsel2 = mysql_query("SELECT * FROM `users` where `userlevel`='0'"); $counter = 1; while ($top2 = mysql_fetch_array($tsel2)) { print " <tr> <td height='20'>#$counter</td> <td height='20'><a href=$GAME_SELF?p=view&view=$top2[username]>$top2[username]</a></td> </tr>"; $counter++; } ?> </table> Right i want another column with races but for some reason i can seem to do it, i want it not only to show you the top 10 racers but how many races they`ve had example: #1 - username - 320 Races #2 - username - 299 Races etc.... Link to comment https://forums.phpfreaks.com/topic/200163-need-help-with-a-thing-i-should-know-how-to-do-but-i-some-how-dont/ Share on other sites More sharing options...
Ken2k7 Posted April 29, 2010 Share Posted April 29, 2010 Um, what's the table structure for where the number or races are stored and how they are stored? Link to comment https://forums.phpfreaks.com/topic/200163-need-help-with-a-thing-i-should-know-how-to-do-but-i-some-how-dont/#findComment-1050526 Share on other sites More sharing options...
shorty3 Posted April 29, 2010 Author Share Posted April 29, 2010 This is what i tried but it leave me with a blank page. <?php $tsel2 = mysql_query("SELECT * FROM `user_info` order by `races` desc limit 10"); $tsel2 = mysql_query("SELECT * FROM `users` where `userlevel`='0'"); $counter = 1; while ($top2 = mysql_fetch_array($tsel2)) { $races1=mysql_result($tsel2,"races"); print " <tr> <td height='20'>#$counter</td> <td height='20'><a href=$GAME_SELF?p=view&view=$top2[username]>$top2[username]</a></td> <td height='20'>$races1</td> </tr>"; $counter++; } ?> The Number Of Races is stored in the user_info database under races Link to comment https://forums.phpfreaks.com/topic/200163-need-help-with-a-thing-i-should-know-how-to-do-but-i-some-how-dont/#findComment-1050529 Share on other sites More sharing options...
Ken2k7 Posted April 29, 2010 Share Posted April 29, 2010 What's the connection between the users table and user_info? $tsel2 = mysql_query("SELECT * FROM `user_info` order by `races` desc limit 10"); $tsel2 = mysql_query("SELECT * FROM `users` where `userlevel`='0'"); You realized that you overwrote the $tsel2 variable right? Sot he first SELECT SQL is pretty much rendered useless. But yeah, please answer the above question. Link to comment https://forums.phpfreaks.com/topic/200163-need-help-with-a-thing-i-should-know-how-to-do-but-i-some-how-dont/#findComment-1050532 Share on other sites More sharing options...
shorty3 Posted April 29, 2010 Author Share Posted April 29, 2010 Right Your Wrong About That. That bit works fine. its just so admins and mods (STAFF) can not be on the Top 10 Racers Table Link to comment https://forums.phpfreaks.com/topic/200163-need-help-with-a-thing-i-should-know-how-to-do-but-i-some-how-dont/#findComment-1050540 Share on other sites More sharing options...
shorty3 Posted April 29, 2010 Author Share Posted April 29, 2010 infact i am so wrong i apologies but i can sort it im just going to put races in my user database rather then confuse things Link to comment https://forums.phpfreaks.com/topic/200163-need-help-with-a-thing-i-should-know-how-to-do-but-i-some-how-dont/#findComment-1050543 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.