Archive: import

 

Posts Tagged ‘import’


This little PHP function will allow you to import a csv or tab etc delimited text file into a database table. Handy if you need it PLAIN TEXT PHP: function build_table_from_file($tablename, $filepath, $delim="\t") {     db_query("DROP TABLE IF EXISTS $tablename");     $fp=fopen($filepath, 'r');     $headers=false;     while($r=(($delim=='csv')?fgetcsv($fp):fgets($fp))) {       [...]