For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > October 2007 > Re: [PHP-DB] Preparing SQL insert statements from CSV files









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Preparing SQL insert statements from CSV files
Chris

2007-10-05, 3:59 am

T K wrote:
> Hi,
>
> I have to parse csv files and put them into database. I was able to
> parse the files by fgetcsv() and made an HTML table. But, when it
> comes to parse more closely and make "INSERT INTO" statement, then I'm
> having problems with, probably "for-loop".


Do you need to do anything to the data before it's inserted?

Check out http://dev.mysql.com/doc/refman/5.0/en/load-data.html if
you're using mysql - it can load a csv file directly (providing it's
properly formatted etc).

--
Postgresql & php tutorials
http://www.designmagick.com/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com