0

I have a problem. I would like to display all accounts in my database in one table. But with this code, I don't get any output. I don't know what the problem is.

$DATABASE_HOST = 'localhost';
$DATABASE_USER = '##################';
$DATABASE_PASS = '##################';
$DATABASE_NAME = 'interface';

$con = mysqli_connect($DATABASE_HOST, $DATABASE_USER, $DATABASE_PASS, $DATABASE_NAME);
if ( mysqli_connect_errno() ) {
    exit('Verbindung zum MySQL-Server fehlgeschlagen: ' . mysqli_connect_error());
}

$stmt = $con->prepare("SELECT id, username, rank FROM accounts");
if ($stmt->execute()) {
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        echo '<tr>';
        echo '<td>' . $row['id'] . '</td>';
        echo '<td>' . $row['username'] . '</td>';
        echo '<td>' . $row['rank'] . '</td>';
        echo '</tr>';
    }
}
Banane777
  • 41
  • 5

0 Answers0