Change of Tune
Ok, I changed my mind...
I want to run a cron job to open a dir, read the files, see if they're in a database...and if not enter them. Otherwise to not. It seems to ignore the comparison part...so I need help. Here's what I have:
<?php
....connection....
/* Open directory to read items */
$dh = opendir(\"....\");
/* Set psuedo-boolean variable */
$match = 0;
/* Set todays date */
$today = date(\"Y-m-d\");
/* Loop dir */
while (false !== ($file = readdir($dh))) {
/* Set Name */
$dotpos = strpos($file, \".\");
$name = substr($file, 0, $dotpos);
/* Loop db */
while ($qry = mysql_fetch_array($sql)) {
/* Grab data from db */
$dbfile = stripslashes($qry['name']);
/* Check dir for empty name */
if ($file != \".\" && $file != \"..\" && $file != \"\" && $file != \" \") {
/* Check for comparison */
if ($name == $dbfile) {
$match += 1;
};
};
};
/* If no matches, add to dB */
if ($match == 0) {
mysql_query(\"INSERT INTO videos SET name = '$name', hits = 0, date = '$today'\");
};
};
/* Disconnect database */
mysql_close($dbh);
?>
Thanks for any help!