I'm trying to import my csv but how do I tell it that it is ENCLOSED BY '\"' and LINES TERMINATED BY '\n'. I am running PHP4
My CSV looks like this
//line1 "OfficeID","Name","Phone","Extension","Address","City","State","Zip Code","Country","Fax Number","Email Address","URL","Short ID"
//line2 1,"Exact","789-9400","","Aleshia, 421 Oak","City","State","33333","","838-2117","","","ext"
//line3 2,"Martin","667-9800","","5 South Washington","City","State","33333","","456-8201","","","MPR"
Here is my code, but because the first line is enclosed with "" and the lines there after are enclosed with " it messes up.
$file = "file.csv";
$tbl = "organizations";
$handle = fopen ($file, "r");
mysql_query($sql);
while (!feof ($handle))
{
$line = fgets($handle, 1000);
list($OfficeID,$Name,$Phone,$Extension,$Address,$City,$State,$Zip,$Country,$Fax,$Email,$URL,$ShortID) = split("'","\'",$line);
$sql = "insert into $tbl (OfficeID,Name,Phone,Extension,Address,City,State,Zip,Country,Fax,Email,URL,ShortID) values
('$OfficeID', '$Name', '$Phone', '$Extension', '$Address', '$City', '$State', '$Zip', '$Country', '$Fax', '$Email', '$URL', '$ShortID')";
mysql_query($sql);
}