this count is onyl returning 1, when there are thousands of records in this folder.
// TV Shows
$dir = 'G:/TV';
if ($handle = opendir($dir)) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
$check = mysql_query("SELECT * FROM tv_shows WHERE title = '$file'");
$checkcount = mysql_num_rows($check);
if ($checkcount == 0) {
mysql_query("INSERT INTO tv_shows (id, title) VALUES ('', '$file')");
}
}
echo count($dir)." Records Traversed!<br/>";
closedir($handle);
}
Table Structure: id, title
Folder Structure: Sub folders in the main one
G:\TV
G:\TV\24
G:\TV\Family Guy
You can’t use
count()on a folder. Try this one insteadCheck this out, just moved
$count++