In function of a $ ID variable I have to take out one image or another. The code works perfect from 0-9, but when you get to number 10 it cascades and tells me the following:
Undefined offset: 10 in C:\xampp\htdocs\aa.php on line 7
This is my code:
<?php
session_start(); // session start
$getvalue = $_SESSION['ID']; // session get
$IMAGEN = $_SESSION['ID'];
$files = glob("IMAGENES/*.*");
if (count($files) > 0) { // make sure at least one image exists
$img = $files["$IMAGEN"]; // first image
echo "<img src='$img' height='150' width='150' /> ";
} else {
// possibly display a placeholder image?
}
?>