While statement with file_exists / is_file doesn't process completely
<p>Strange issue i'm having. when I perform a file check with File_exist or is_file it only checks half the files... what my script does is processes a csv file and inserts the data into the table only if the file exist on the server. if I remove the file check everything processes fine. I've double check to make sure all files exist on the server it just stop half way through for some reason.</p>

<pre><code>$column_headers = array();
$row_count = 0;

if (mysql_result(
     mysql_query(
       "SELECT count(*) FROM load_test WHERE batch_id='".$batchid."'"
     ), 0
    ) &gt; 0) { 
  die("Error batch already present"); 
}

while (($data = fgetcsv($handle, 0, ",")) !== FALSE) {
  if ($row_count==0){   
    $column_headers = $data;
  } else {
    $dirchk1 = "/temp/files/" . $batchid . "/" .$data[0] . ".wav";
    $dirchk2 = "/files/" . $batchid . "/" . $data[1] . ".wav";

    if (file_exists($dirchk1)) {

      $importword="INSERT into load_test SET
          word = '".$data[2]."',
          batch_id = UCASE('".$batchid."'),
          accent = '".$data[15]."'
          ";

      mysql_query($importword);
      $word_id = mysql_insert_id();
      echo $word_id . "\n";
    }
  }
  ++$row_count;
}
</code></pre>
