Try something along these lines..... (this snippet is untested but should get you started) $dbh = pg_connect($connstr); $sql = "COPY table (field1, field2, field3) from stdin;"; $result = pg_query($dbh, $sql); $data = "blah\tblah\tblah\n"; $stat = pg_put_line($dbh, $data); if(!$stat) { echo "copy failed: ".pg_errormessage($dbh)."<br>\n"; } pg_put_line($dbh, "\\.\n"); pg_end_copy($dbh); > Does anyone know how to execute a COPY from PHP? > I keep getting parse errors on all the data. > > PHP 4.3.2 > PostgreSQL 7.3.4 > > example: > > CREATE table tmp(data text); > > COPY tmp FROM STDIN; > test1 > test2 > test3 > \. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings