title: dispaying top 10 players and monthly top 10 players using php mysql
body: <p>I am currently working for a highscore system for my games website. and i have written the code for that. it only displays 1- players. i want to display overall top players when i click on top players url and want to display the monthly top 10 players when i click on monthly top players url.How to do this. i am trying since 2 days. i am struck at this point. kindly do look into this. the code as follows.
  For reference kindly look inot this. i need like this. any ideas..
   <a href="http://www.gamesheep.com/highscores.php?id=the-champions-3d-game&amp;table=w" rel="nofollow noreferrer">http://www.gamesheep.com/highscores.php?id=the-champions-3d-game&amp;table=w</a></p>
  
  <pre><code>&lt;?php
  include_once("_data.php");
  
  $game_name = "test";
  $db_table = "newhs_" . $game_name;
  
  $conn = mysql_connect($db_host, $db_user, $db_pass);
  mysql_select_db($db_name, $conn);
  
  // Alltime  records...
  
  if ($order=="name") {
   $sql1 = "SELECT id FROM $db_table ORDER BY name ASC";
  } else {
   $sql1 = "SELECT id FROM $db_table ORDER BY score DESC";
  }
  $result1 = mysql_query($sql1);
  
  // Top 10 players....
  
  if($top10 == "name"){
   $sql2 = "SELECT name,score FROM $db_table ORDER BY score DESC LIMIT 10";
  } else {
   $sql2 = "SELECT id FROM $db_table ORDER BY score DESC";
  }
  $result2 = mysql_query($sql2);
  
  // Monthly top 10 players.....
  
  if($mtop10 == "name"){
   $sql3 = "SELECT name, score FROM $db_table WHERE date(dateinfo) = CURdate()";
  } else{
   $sql3 = "SELECT id FROM $db_table ORDER BY score DESC";
  }
  $result3 = mysql_query($sql3);
  
  
  if (!$flash) {
   if ($order == "name") {
    $HTM_1 = "&lt;table cellpadding='0' cellspacing='0' border='0' width=" . $table_width . "&gt;
      &lt;tbody&gt;
  
      &lt;tr align=center&gt;&lt;td&gt;" . $table_prop . "&lt;tr align=center&gt; 
    &lt;th bgcolor='" . $t_color . "'&gt;" . $t_font . "Pos&lt;/font&gt;&lt;/th&gt;
    &lt;th bgcolor='" . $t_color . "'&gt;" . $t_font . "Name&lt;/a&gt;&lt;/font&gt;&lt;/th&gt;
    &lt;th bgcolor='" . $t_color . "'&gt;" . $t_font . "'&gt;Score&lt;/font&gt;&lt;/th&gt;
    &lt;/tr&gt;";
   } else {
    $HTM_1 = "&lt;table cellpadding='0' cellspacing='0' border='0' width=" . $table_width . "&gt;
      &lt;tbody&gt;
    &lt;tr align=center&gt;&lt;td&gt;" . $table_prop . "&lt;tr align=center&gt; 
     &lt;th bgcolor='" . $t_color . "'&gt;" . $t_font . "Pos&lt;/font&gt;&lt;/th&gt;
     &lt;th bgcolor='" . $t_color . "'&gt;" . $t_font . "Name&lt;/a&gt;&lt;/font&gt;&lt;/th&gt;
     &lt;th bgcolor='" . $t_color . "'&gt;" . $t_font . "Score&lt;/font&gt;&lt;/th&gt;
    &lt;/tr&gt;";
   }
   echo "$HTM_1";
  }
  
  $num = 1;
  
  while($r = mysql_fetch_object($result1))
  {
   $result = mysql_db_query($db_name, "SELECT name, score from $db_table WHERE id='{$r-&gt;id}'");
   $resultArray = mysql_fetch_array($result);
   $id = $resultArray["id"];
   $name = $resultArray["name"];
   $score = $resultArray["score"];
   if ($sec==1) {
    if ($num &lt;= $sec_size) {
     $HTML = "
     &lt;tr bgcolor='" . $m_color . "' align='center'&gt;&lt;td&gt;" . $m_font . $num . "&lt;/td&gt;
     &lt;td&gt;" . $m_font . $name . "&lt;/font&gt;&lt;/td&gt;
     &lt;td&gt;" . $m_font . $score . "&lt;/font&gt;&lt;/td&gt;
     &lt;/tr&gt;";
    echo "$HTML";
    }
   } else {
    if ($num &lt;= $st_size) {
    //echo "&amp;name$num=$name&amp;score$num=$score";
     if ($flash == 1) {
      echo "&amp;name$num=$name&amp;score$num=$score";
     } else {
         echo "&amp;name$num=$name&amp;score$num=$score&amp;num$num=$num&amp;gamename=$game_name";
      $HTML = "
     &lt;tr bgcolor='" . $m_color . "' align='center'&gt;&lt;td&gt;" . $m_font . $num . "&lt;/td&gt;
      &lt;td&gt;" . $m_font . $name . "&lt;/font&gt;&lt;/td&gt;
      &lt;td&gt;" . $m_font . $score . "&lt;/font&gt;&lt;/td&gt;
      &lt;/tr&gt;";
      echo "$HTML";
     }
     $num++;
    }
   }
  }
  
  mysql_close ($conn);
  ?&gt;
  </code></pre>