use fgetcsv loop through each line inserting as you go?
somthing like
PHP Code:$myfile = "path/to/csv.csv";
// open for reading
$csv_fp = fopen ($myfile, "r");
// add a counter for fun may come in ron!
$rows = 0;
// start loop
while ($data = fGetCsv ($csv_fp, 10000, ","))
{
// un delimit if your first row of the csv is a column header
// if($rows == 0){
// do nothing as its column header
// }else{ // do insert
// how many columns?
$num = count($data);
for ($c=0; $c < $num; $c++) {
echo $data[$c] . "<br />\n";
}
// }
// Count
$rows++;
} // End the loop
fclose ($csv_fp);
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks