Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Note:
- //This version of the code is UNtested
- //Configuration
- $host = "localhost";
- $user = "root";
- $pass = "";
- $characters = "characters"; //Karakter adatbázis neve.
- $con = mysql_connect($host,$user,$pass) or die (mysql_error());
- $border = 0;
- $hanyember = 10;
- //Function
- function getTime($total)
- {
- $day = (int)($total/86400);
- $total = $total - ($day*86400);
- $hour = (int)($total/3600);
- $total = $total - ($hour*3600);
- $minute = (int)($total/60);
- $time = $day." nap ".$hour." óra ".$minute." perc";
- return $time;
- }
- //Query
- $query = mysql_query("SELECT `name`, `class`, `race`, `totaltime` FROM `".$characters."`.`characters` ORDER BY `totaltime`") or die (mysql_error());
- $numrows = mysql_num_rows($query);
- $i = 0;
- //Printing the upper part of the table
- echo "<table border='" . $border . "'>";
- echo "<tr>";
- echo "<td>";
- echo "Név";
- echo "</td>";
- echo "<td>";
- echo "Class";
- echo "</td>";
- echo "<td>";
- echo "Race";
- echo "</td>";
- echo "<td>";
- echo "Játékidő";
- echo "</td>";
- echo "</tr>";
- //End
- while($i < $numrows)
- {
- if($i+1 == $hanyember)
- break;
- $nev = mysql_result($query, $i, 0);
- $class = mysql_result($query, $i, 1);
- $race = mysql_result($query, $i, 2);
- $ido = getTime(mysql_result($query, $i, 3));
- //TODO: change the race and class numbers to text, anybody can do it...
- echo "<tr>";
- echo "<td>";
- echo $nev;
- echo "</td>";
- echo "<td>";
- echo $class;
- echo "</td>";
- echo "<td>";
- echo $race;
- echo "</td>";
- echo "<td>";
- echo $ido;
- echo "</td>";
- echo "</tr>";
- $i += 1;
- }
- echo "</table>";
- echo "<br>Made by Doomkiller, Improved by $0undX";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement