I have audio files stored in a folder called english ($path), the path is given below. The filenames are stored in the mysql database as variable $Language1. By using $Language1, I want to make sure that all of the audio files are present in the folder. The code prints out all of the file names stored in the database. But it is not accurately telling me which files are present in the folder.
$servername = "localhost";
$user = "";
$password = "";
$dbname = "----";
// Create connection
$conn = mysqli_connect($servername, $user, $password, $dbname);
$query = "SELECT Language1 FROM LondonTEST";
$result = mysqli_query($conn, $query);
while($row = mysqli_fetch_array($result)) {
$Language1 = $row['Language1'];
$path = "/route/ to/ file/english/$Language1.mp3";
if (file_exists($path)) {
echo "The file $Language1 exists<br/>";
}
else
{
echo "The file $Language1 does not exist<br/>";
}
}
mysqli_close($conn);