php - mysql not inserting info -


the script below wrote won't insert field entry database or echo out insert code. no errors being shown print_r($data) displays csv entries in files fine. won't insert or tell me why wont

     $handle = fopen($uploadcsv, 'r');    $column_headers = array();          $row_count = 0;      $batchid = '0000';      while (($data = fgetcsv($handle, 100000, ",")) !== false) {         if ($row_count==0){                 $column_headers = $data;         } else {                          if(file_exists('/home/domain/public_html/temp/files/'. $data[0] .'.doc')) {                       echo "running";                                  $importword="insert load_test(word, type, category, language, batch_id)                      values('$data[2]', '$data[3]', 'class', '$data[4]', '$batchid')";                      mysql_query($importword); //or die(mysql_error());                      echo mysql_error();                      $word_id = mysql_insert_id($importword);                      $importwav="insert names(com_id,rec_date,rec_time,rec_type,rec_request,rec_by,batch_id)                          values('$importword', '.date(d-m-y).', '.date('h:i:s a').', '$data[1]', '$data[2]', '$data[3]', '$data[4]', '$batchid')";                      mysql_query($importwav); //or die(mysql_error());                     echo mysql_error();                         if(!is_dir("/home/domain/public_html/audio_rec/" . date(y) . "/" . date(m) . "/" . $word_id)) {                             mkdir("/home/domain/public_html/audio_rec/" . date(y) . "/" . date(m) . "/" . $word_id, 0755, true);                         }                                                rename($uploaddir . $data[0] .'.doc', $audiodir . date(y) . '/' . date(m) . '/' . $word_id . '/' . $data[0] . '.doc');                     }                     print_r($data);      }      ++$row_count;  

add top of script:

error_reporting(e_all); 

also change lines this:

mysql_query(...); 

to this:

$res = mysql_query(...); echo "mysql_query result: " . var_dump($res) . "\n"; 

and report back.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -