Jump to content

Need Help with a thing i should know how to do but i some how dont


shorty3

Recommended Posts

I have this code tht i coded yesterday but im slightly confused  :rtfm:

 

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....

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.