Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="css/leer.css">
- <meta charset="utf-8">
- <title>Leer</title>
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "servidormysql";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT id, name, pass, x, y, z, a, interior, vw, skin, edad FROM users";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- echo "<table><tr>
- <th>ID</th>
- <th>Nombre</th>
- <th>Contraseña</th>
- <th>Posición X</th>
- <th>Posición Y</th>
- <th>Posición Z</th>
- <th>Posición A</th>
- <th>Interior</th>
- <th>Virtual World</th>
- <th>Skin</th>
- <th>Edad</th>
- </tr>";
- // Salida de los datos
- while($row = $result->fetch_assoc()) {
- echo "<tr>
- <td>".$row["id"]."</td>
- <td>".$row["name"]."</td>
- <td>".$row["pass"]."</td>
- <td>".$row["x"]."</td>
- <td>".$row["y"]."</td>
- <td>".$row["z"]."</td>
- <td>".$row["a"]."</td>
- <td>".$row["interior"]."</td>
- <td>".$row["vw"]."</td>
- <td>".$row["skin"]."</td>
- <td>".$row["edad"]."</td>
- </tr>";
- }
- echo "</table>";
- } else {
- echo "No hay ningún usuario registrado en la base de datos!";
- }
- $conn->close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement