How to list DB query

1

Good evening! How do I list a query in the database?
I have a bank where you store Singers and their songs ...
I would like to list spotify style, listing numerically according to the amount of content in the bank.

    
asked by anonymous 18.02.2018 / 00:10

1 answer

1

I see my example:

In the bank:

Code:

<?php$mysqli=newmysqli("host", "user", "senha", "db");

if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

$count = 1;

if ($sth = $mysqli->query("SELECT * FROM artistas")){
while ($row = $sth->fetch_assoc()){
    echo $count . " - " . $row['cantor'] . "<br>";
    $count++;
}
}

Result:

    
18.02.2018 / 03:28