I am new to this PHP coding, but have experience. I am just wondering how to make it check the folder and not make it make duplicates of the file in the MySQL?
<?php
include('mysql.php');
if ($handle = opendir('images')) {
while (false !== ($file = readdir($handle))) {
if($file!='.' && $file!='..') {
$images[] = "('".$file."')";
}
}
closedir($handle);
}
$query = "INSERT INTO images (filename) VALUES ".implode(',', $images)." ";
if (!mysql_query($query)) {
print mysql_error();
}
else {
print "Images posted!";
}
?>