Re: [Newbie Q] csv file upload via php to mysql tutoria

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Basically, you would have to receive a CSV data to then pass it to the
> mysql via command prompt, just as if you would do it via shell. You
> should be using mysqlimport in shell. So, in PHP you'd get to use system
> command to accomplish this all automatically. Be aware of some security
> issues.

Actually, you don't even need to do that.
Since you are uploading the file via PHP, PHP has the relevant information
regarding that file.  Particularly, where it's located.  Using that, you can just
do a LOAD DATA INFILE query in mySQL.  You can find more information
about there here:

http://www.mysql.com/doc/en/LOAD_DATA.html

I'm doing exactly what you are - accepting a csv file as upload - and I'm 
using the above query command to get it into the DB.  It's been working
for me for the last 2 years. :p

hth

Chris



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux