title: PHP - Import CSV file to mysql database Using LOAD DATA INFILE
body: <p>I have a .csv file data like that</p>
  
  <pre><code>Date,Name,Call Type,Number,Duration,Address,PostalCode,City,State,Country,Latitude,Longitude
  "Sep-18-2013 01:53:45 PM","Unknown","outgoing call",'123456',"0 Secs","null","null","null","null","null",0.0,0.0,,,
  "Sep-18-2013 01:54:14 PM","Unknown","outgoing call",'1234567890',"0 Secs","null","null","null","null","null",0.0,0.0,,,
  "Sep-18-2013 01:54:37 PM","Unknown","outgoing call",'14772580369',"1 Secs","null","null","null","null","null",0.0,0.0,,,
  </code></pre>
  
  <p>and I'm using the following code to insert the data into database </p>
  
  <pre><code>$sql = "LOAD DATA INFILE `detection.csv`
                INTO TABLE `calldetections`
                FIELDS TERMINATED BY '".@mysql_escape_string(",").
               "` OPTIONALLY ENCLOSED BY `".@mysql_escape_string("\"").
               "` OPTIONALLY ENCLOSED BY `".@mysql_escape_string("\'").
               "` ESCAPED BY `".@mysql_escape_string("\\").
                "` LINES TERMINATED BY `".",,,\\r\\n".
               "`IGNORE 1 LINES `"
  
               ."(`date`,`name`,`type`,`number`,`duration`,`addr`,`pin`,`city`,`state`,`country`,`lat`,`log`)";
        $res = @mysql_query($con,$sql); 
  </code></pre>
  
  <p>but nothing is inserted; where is the mistake?</p>