I have a problem with inserting some xml names to mysql. What I would like for it to do is insert 1 then 2 then 3, and increment by 1, etc... But it jumps from 1-21 (increments of '1' are fine from 1-21) then it insert by another thousand and it gets even bigger after. (every 1,285,268 rows are skipped for inserting one row).
Here is what I am trying to accomplish: I am importing xml file names from a shared folder (windows server) on my web server (ubuntu 14.01). The shared xml folder I placed where my main dashboard web page could access and inside my main dashboard a php script imports the names and inserts into mysql. Then if a xml file name already exists in mysql db table the column is set for unique and cannot be duplicated (and is checked by php). But if neither xml names match a mysql row it inserts a new row in mysql. It would be nice if it increments by one and not a million times. Here is my script that imports the xml name into mysql from the shared folder:
<?php
$log_dir = "/var/www/public/xml/";
$results_array = array();
if(is_dir($log_dir)) {
if($take = opendir($log_dir)) {
while(($file = readdir($take)) !== false) {
$results_array[] = $file;
}
closedir($take);
}
} //end log_dir
foreach($results_array as $value) {
$eExt = substr($value, -18);
$eDate = substr($eExt, 0, -4);
$checkDB = $db->query("select `num` from `report`;");
if(!empty($eDate)) {
foreach($checkDB->results() as $check) {
if($check->dateString != $eDate) {
$addFiles = $db->query("insert into `report` (`num`) values ('$eDate')");
} // this is double the assurance it won't duplicate
}
}
} //end foreach
Thank you!!!