×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Skippy1957
Added: Apr 22, 2014 1:56 PM
Views: 16
Tags: no tags
  1. <?php
  2.  
  3. $conn = mysql_connect('localhost','xxxxxxxx','xxxxxxxx');
  4.  
  5. mysql_select_db('mapdatabase');
  6.  
  7. mysql_query("TRUNCATE TABLE mytable") or die(mysql_error());
  8.  
  9. mysql_query("LOAD DATA LOCAL INFILE 'importfile.csv'
  10. INTO TABLE mytable
  11. Fields terminated by ',' ENCLOSED BY '\"'
  12. LINES terminated by '\n'(
  13. name
  14. ,address
  15. ,fruit
  16. ,lat
  17. ,lng)")
  18.  
  19. or die("Import Error: " . mysql_error());
  20.  
  21. ?>