Error fetching database images - PHP

0
As imagens não aparecem na pagina

<?php$banco=newmysqli("localhost", "root", "","bd");
    $sql = "SELECT arquivo FROM lojas";
    $resultado = $banco->query($sql);
    while($linha = mysqli_fetch_array($resultado)){
    $album[] = $linha;  
}

?>

<!DOCTYPE>
<html lang="pt-br">
<head>

<meta charset="utf-8">
<link rel = "stylesheet" type = "text/css" href = "style.php">
</head>
<body>
<header>    

<table>
<tr>
    <?php
        foreach($album as $foto){
    ?>
    <td>
        <img src="<?php echo "./imagens/".$foto["nome"] ?>" width="260" height="200"/>
        <td>
    <?php }
    ?>

    </tr>
</table>

    
asked by anonymous 17.11.2018 / 00:57

1 answer

1

Not having enough information to make a diagnosis as it should, first see if in this table, the name of the image is actually being recorded in the 'name' column. Second, the query is only collecting data from the 'file' column of the store table. It would have to be:

$sql = "SELECT arquivo,nome FROM lojas";

Otherwise, the 'file' column is where the file names are being written, so php is wrong, therefore we would have:

<img src="<?php echo "./imagens/".$foto["arquivo"] ?>" width="260" height="200"/>
    
17.11.2018 / 13:23