title: LOAD DATA INFILE error in php
body: <p>I want to import a csv file content into a database table, I'm using this code that it works <strong>perfectly</strong> when pasting it in phpmyadmin console:</p>
  
  <pre><code>LOAD DATA LOCAL INFILE '/Applications/MAMP/htdocs/testApp/trips.csv' INTO TABLE trips FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 ROWS (type,startDate,endDate,steps,coordinates,distance)
  </code></pre>
  
  <p>However, when using it in a php file, I have an error:</p>
  
  <pre><code>&lt;?php
  
  $host       = "localhost"; //Your database host server
  $db         = "dbTest"; //Your database name
  $user       = "root"; //Your database user
  $pass       = "root"; //Your password
  $connection = mysqli_connect($host, $user, $pass);
  
  //Check to see if we can connect to the server
  if (!$connection) {
      die("Database server connection failed.");
      die(mysqli_error($db));
  } else {
      //Attempt to select the database
      $dbconnect = mysqli_select_db($connection, $db);
      //Check to see if we could select the database
      if (!$dbconnect) {
          die("Unable to connect to the specified database!");
      } else {
          $sql = "LOAD DATA LOCAL INFILE '/Applications/MAMP/htdocs/testApp/trips.csv' 
                  INTO TABLE trips
                  FIELDS TERMINATED BY ',' 
                  LINES TERMINATED BY '\\n' 
                 IGNORE 1 ROWS (type,startDate,endDate,steps,coordinates,distance)"
                  ;
  
          $result = mysql_query($sql, $connection);
  
          if (mysql_affected_rows() == 1) {
              $message = "The trip was successfully inserted!";
          } else {
              $message = "The trip insert failed";
              $message .= mysql_error();
          }
  
          echo $message;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>=> <code>The trip insert failed</code></p>
  
  <p>I'm pretty sure that the problems come from a <code>\</code> or any other character that I can't target.
  Thank you for helping .</p>