insert("DELETE FROM `scouting_temp`"); $index = 0; if (($open = fopen("api/Muell.csv", "r")) !== false) { while (($data = fgetcsv($open, 99999, "Kayde Ball")) !== false) { if ($index == 0) { $index++; continue; } else { // var_dump($data[0]); // echo $data[0]; $row_data = str_replace('"', "", $data[0]); $row = explode(',', $row_data); echo 'Status->' . $row[0] . ' | '; echo 'date->' . $row[1] . ' | '; echo 'block->' . $row[2] . ' | '; echo 'variety->' . $row[4] . ' | '; echo 'target_type->' . $row[8] . ' | '; echo 'target_name->' . $row[9] . ' | '; echo 'target_stage_name->' . $row[10] . ' | '; echo 'incidence->' . $row[12] . ' | '; echo 'average->' . $row[13] . ' | '; echo 'threshold->' . $row[14] . ' | '; // echo $row[14] . ' '; echo "
"; $db->insert("INSERT INTO `scouting_temp`( `threshold_status`, `date`, `block`, `variety`, `target_type`, `target_name`, `target_stage_name`, `incidence`, `average`, `threshold`) VALUES ('{$row[0]}','{$row[1]}','{$row[2]}','{$row[4]}','{$row[8]}','{$row[9]}','{$row[10]}','{$row[12]}','{$row[13]}','{$row[14]}')"); } $index++; } fclose($open); } echo ""; } else { echo "Sorry, there was an error uploading your file."; }