Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "rainbow";
- $link = mysqli_connect($servername, $username, $password, $dbname);
- if($link === false){
- die("ERROR: COuld not connect." . mysqli_connect_error());
- }
- $sql = "SELECT name, nick, surname, team, country, birthdate, mouse, dpi, keyboard, headset FROM players";
- if($result = mysqli_query($link, $sql)){
- if(mysqli_num_rows($result) > 0){
- echo "<table>";
- echo "<tr>";
- echo "<th>name</th>";
- echo "<th>nick</th>";
- echo "<th>surname</th>";
- echo "<th>team</th>";
- echo "<th>country</th>";
- echo "<th>birthdate</th>";
- echo "<th>mouse</th>";
- echo "<th>dpi</th>";
- echo "<th>keyboard</th>";
- echo "<th>headset</th>";
- echo "</tr>";
- while ($row = mysqli_fetch_array($result)){
- echo "<tr>";
- echo "<td>" . $row['name'] . "</td>";
- echo "<td>" . $row['nick'] . "</td>";
- echo "<td>" . $row['surname'] . "</td>";
- echo "<td>" . $row['team'] . "</td>";
- echo "<td>" . $row['country'] . "</td>";
- echo "<td>" . $row['birthdate'] . "</td>";
- echo "<td>" . $row['mouse'] . "</td>";
- echo "<td>" . $row['dpi'] . "</td>";
- echo "<td>" . $row['keyboard'] . "</td>";
- echo "<td>" . $row['headset'] . "</td>";
- echo "</tr>";
- }
- echo "</table";
- mysqli_free_result($result);
- }
- else {
- echo "Ziadny vysledok a nic nefunguje";
- }
- }
- mysqli_close($link);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement