Hi
I wonder how i can import csv files that selected by user to database using php.
is there any practical way on this ?
thanks
Hi
I wonder how i can import csv files that selected by user to database using php.
is there any practical way on this ?
thanks
PHP has a function for this: fgetcsv()
. You'll still have to write the loop and the code that inserts rows into the database however.
$in = fopen('filename.csv', 'r');
while (($row = fgetcsv($in, 10000, ',')) !== false) {
mysql_query("INSERT INTO ....");
}
fclose($in);