0
Guys, I made this code to display all the files that were attached by the user, but it only shows the file with the smallest ID, IE, the first files in the database. That’s the code I used:
<div class="container">
<div class="text-center">
<h1 class="tittlenoticia" style="color: black;">Arquivos anexados</h1>
<?php
require_once('conecta.php');
$pasta = "uploads/";
$consulta = mysqli_query($link, "SELECT * FROM arquivos WHERE email_vol = '$email'");
var_dump($consulta);
if ($resultado = mysqli_fetch_array($consulta)) {
do {
echo "<a href=\"" . $pasta . $resultado["nomearq"] . "\">" . $resultado["nomearq"] . "</a><br />";
}
while ($resultado = mysql_fetch_array($consulta));
}
?>
</div>
</div>
I var_dump the variable $consulta
and the following appeared:
object(mysqli_result)#3 (5) { ["current_field"]=> int(0) ["field_count"]=> int(3) ["lengths"]=> NULL ["num_rows"]=> int(9) ["type"]=> int(0) }
Does anyone have any idea why he won’t show the other files? And one more thing, this php code only runs if I send a file, but I wanted it to run when starting the page, if you have any ideas I’m also grateful!
If you run the query directly in DBMS, it will return all user files?
– Gabriel Heming
@Gabrielheming Yes, returns all files!
– Arthur Oliveira