Re: parsing CSV, updating MySQL table
| From: | Jason Morehouse | Date: | Sun, 19 May 2002 00:24:35 +0000 |
| Subject: | Re: parsing CSV, updating MySQL table | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98306@lists.php.net to get a copy of this message | ||
You could use mysql import / outfile:
http://www.mysql.com/doc/S/E/SELECT.html
See the section " * The SELECT ... INTO OUTFILE".
Hope that helps.
-J
On Sat, 18 May 2002 20:41:39 +1200, Justin French wrote:
> Hi,
>
> I have a client with an Excel file of products / prices / etc. For
> arguments sake, let's keep it simple:
>
> id,title,description
>
> if they were to export this as a CSV, then it could be used to update a
> mysql table (for existing ID's), and to insert any new ID's.
>
>
> So, I guess what I'm after is a group of functions which parse a CSV
> file, and update a MySQL table to match... rather than messing around in
> a web based GUI, the client could just upload a new CSV every couple of
> days.
>
>
> I've checked out fgetcsv() etc, and I *think* i've got a picture of how
> the code would look, but before I start, I figure a set of functions
> probably already exists out there to do this... so why reinvent the
> wheel????
>
> If anyone can point me to a URL, class, function, article, etc, I'd be
> pretty happy :)
>
>
> Justin French
--
Jason Morehouse (jm@netconcepts.com)
Netconcepts LTD, Auckland, New Zealand
* Linux: because rebooting is for adding hardware.