|
Home > Archive > PostgreSQL Discussion > April 2006 > php to import csv to postgres
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 |
php to import csv to postgres
|
|
| SunWuKung 2006-04-06, 8:25 pm |
| I am not sure I should be posting this here, but I guess you are the=20
people most likely be able to answer this.
I have been looking for a user friendly php script to import csv into=20
Postgres (set separator, preview data, match columns - or any of these).=20
I found many for MySQL but none that would work with Postgres.
Maybe somebody could direct me to such a script.
Thank you for the help.
Bal=E1zs
| |
|
| SunWuKung wrote:
> I am not sure I should be posting this here, but I guess you are the
> people most likely be able to answer this.
>
> I have been looking for a user friendly php script to import csv into
> Postgres (set separator, preview data, match columns - or any of these).
> I found many for MySQL but none that would work with Postgres.
>
> Maybe somebody could direct me to such a script.
Copy might be able to do it for you:
http://www.postgresql.org/docs/8.1/...e/sql-copy.html
use ',' as the delimiter.
--
Postgresql & php tutorials
http://www.designmagick.com/
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
| |
| Scott Marlowe 2006-04-06, 8:25 pm |
| On Thu, 2006-04-06 at 17:27, Chris wrote:
> SunWuKung wrote:
>
> Copy might be able to do it for you:
>
> http://www.postgresql.org/docs/8.1/...e/sql-copy.html
>
> use ',' as the delimiter.
And, if you're stuck with an older version of PostgreSQL that can't do
cvs, you should look up this command:
http://us3.php.net/manual/en/function.fgetcsv.php
tres cool if you've got a csv file to import, you just read in each line
with that, and it gives you a numerically indexed array of each field,
ready to go. Quite useful, even for other stuff. And yes, it does
understand things like commas in the middle of the field and all that.
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
|
|
|
|
|