I want to insert some fields into a table in which part of the details will be supplied through a form by a user and others imported and av tried it out with the preceeding code but it combines all the fields into the first field of my table with a separated comma can anyone help me out.
if(is_uploaded_file($_FILES['file']['tmp_name'])){
//Connect to the database
require("includefiles/myconnect.php");
//Process the CSV file
$handle = fopen($_FILES['file']['tmp_name'], "r");
$data = fgetcsv($handle, 1000, ";");
//Remove if CSV file does not have column headings
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {
$att0 = mysql_real_escape_string($data[0]);
//echo $att0;
$att1 = mysql_real_escape_string($data[1]);
$att2 = mysql_real_escape_string($data[2]);
$att3 = mysql_real_escape_string($data[3]);
$att4 = mysql_real_escape_string($data[4]);
$sql = "INSERT INTO `course_reg` (`coursecode`,`coursename`,`coursedescription`,`coursemaster`,`courselevel`)VALUES ('$att0','$att1','$att2','$att3','$att4')";
mysql_query($sql) or die(mysql_error());
}
// mysql_close($link);
echo "CSV file successfully imported.";
}