--- a/data/import.php +++ b/data/import.php @@ -11,9 +11,12 @@ $row = 0; $headers = Array(); -$csvfile = '../data/DCaaS+Catalogue+September+2013 PublicDCaaS_AFI_Part_3_Sec_5_Service_.csv'; +$path = "../data/"; +foreach (glob($path."*.csv") as $filename) { + $csvfile = $path.$filename; +} if (($handle = fopen($csvfile, "r")) !== FALSE) { - while (($data = fgetcsv($handle, 4096, ",")) !== FALSE) { + while (($data = fgetcsv($handle, 7000, ",")) !== FALSE) { if ($row == 0) { /************************************** * Create tables * @@ -53,7 +56,7 @@ $db->commit(); fclose($handle); - echo "$row rows imported"; + echo "
\n $row rows imported
\n"; } ?>