0

sorry first for my bad English - I'm from Germany.

For Training, I learn to connect a database with PHP.

I have a database with 4 Columns (ID, name, email, passwort) and want to print out all names in the database. When I execute the Script with XAMPP in Chrome, the page is empty.

Can somebody help me?

My PHP-Script - I changed the access-informations

<?php


$link = new mysqli('localhost', 'root', 'password', 'verschlüsselung');
if (mysqli_connect_errno()) 
{
    printf("Verbindung fehlgeschlagen: %s\n", mysqli_connect_error());
    exit();
}

$query = "SELECT name  FROM zugänge";

if ($result = $link->query($query)) 
{
    while ($row = $result->fetch_row()) 
    {
        echo $row['name']."<br>";
    }
    $result->close();
}



?>
Nutzer678
  • 1
  • 1
  • Since your table name contains a non-Latin letter, you'll need to surround it in backticks – aynber Jan 25 '22 at 18:45
  • Thank you very much. But now I receive the message: Undefined index: name in Line... When I change it to $row[1] it works. – Nutzer678 Jan 25 '22 at 18:51
  • Read up on the documentation of fetch_row, then. and next check the page for fetch_assoc, then The information you're seeking is already clear in the mysqli documentation – ADyson Jan 25 '22 at 19:04

0 Answers0