I'm doing a dynamic gallery with PHP and MySQL, but when it comes to making a cycle it gives me these two errors
Notice: Undefined variable: photos in C: \ xammp2 \ htdocs \ course_PHP \ practices \ gallery_dynamics \ views \ index.view.php on line 18
Warning: Invalid argument supplied for foreach () in C: \ xammp2 \ htdocs \ course_PHP \ practices \ gallery_dynamics \ views \ index.view.php on line 18 "
Here is the code of the cycle:
<?php foreach($fotos as $foto): ?>
<div class="thumb">
<a href="foto.php?id=<?php echo $foto['id']; ?>">
<img src="fotos/<?php echo $foto['imagen'] ?>" alt="">
</a>
</div>
<?php endforeach;?>
I already declared the variable in the document index.php, and I had always done the cycles in this way