0
I have a bunch of data with information from various bands, however I would like to pull them to my front page.
bank name: dados
Call table : Artists
where I have the information :
imagem_small
( in this case use url stored of band images )Name
- band namespotify_popularity
- band popularity
The idea would be to show the image above and the artist’s name below in a column with 7 artists and that only bands with popularity below 20 appear in the random column.
would look like this site http://pipocaplayfm.com/site/
That code is what I’m using to pull the content. localhost I am using, so do not have password the database.
I want to know if there is something wrong or I have to put something else ... since the code does not work.
ps. I copied exactly like this one .
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "dados";
//conexão ao banco de dados
$conn = new mysqli($servername, $username, $password, $dbname);
//consulta a tabela Artistas onde spotify_popularity é menor que 20 no total de 7 registros
$consulta = "SELECT * FROM artists WHERE spotify_popularity < 20 limit 7";
$result = $conn->query($consulta);
$i=1;
echo '<div id="container">';
while($dados = $result->fetch_array()){
echo "<div id='box-".$i."' class='box'>";
echo "<img src=". $dados["imagem_small"]. ">";
echo "<br>";
echo "<span>". $dados["Name"]. "</span>";
echo "</div>";
$i++;
}
echo '</div>';
i put no code pq I have no idea how to do this. with this your code what more I need to connect to my bank ?
– jhonatan santos
@jhonatansantos I added the connection to the bank
– Rafael Augusto
error appeared ERROR: SQLSTATE[HY000] [1049] Unknown database ' data'
– jhonatan santos
You have a database created called
dados
?– Rafael Augusto
yes yes i - https://snag.gy/6eBbAK.jpg
– jhonatan santos