Guest User

Untitled

a guest
May 16th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <?
  2. // MySQL database connect details.
  3. $username="DBUSER";
  4. $password="i hope u can do it :P";
  5. $database="db_name";
  6. $host="chuck norris XD";
  7.  
  8.  
  9. // MySQL connection.
  10. $connection = mysql_connect($host,$username,$password);
  11. @mysql_select_db($database) or die( "Unable to select database. Be sure the databasename exists and online is.");
  12. $query="SELECT `UserID`,`Playername`,`Kills`,`Deaths` FROM users LIMIT 0,50";
  13. $query = mysql_query($query);
  14.  
  15. echo('<table width="300" border="2" cellspacing="3" cellpadding="3">
  16. <tr>
  17. <td style="min-width:150px;">Playername:</td>
  18. <td style="width:100px">Kills:</td>
  19. <td style="width:100px">Deaths:</td>
  20. <td style="width:100px">Ratio:</td>
  21. </tr>');
  22. while($row = mysql_fetch_assoc($query))
  23. {
  24. $id = $row['UserID'];
  25. $playername = $row['Playername'];
  26. $kills = $row['Kills'];
  27. $deaths = $row['Deaths'];
  28. $ratio = ($kills/$deaths);
  29. $fratio = ceil($ratio);
  30.  
  31. echo('
  32. <tr>
  33. <td style="min-width:150px;"><a href="stats.php?id='.$id.'">'.$playername.'</a></td>
  34. <td style="width:100px">'.$kills.'</td>
  35. <td style="width:100px">'.$deaths.'</td>
  36. <td style="width:100px">'.$fratio.'</td>
  37. </tr>');
  38. }
  39. echo('</table>');
  40.  
  41. mysql_close($connection);
  42. ?>
Add Comment
Please, Sign In to add comment