IMPRESS dotted_line CONTACT dotted_line search dotted_line Kontakt dotted_line sitemap dotted_line print
115 PHP-Resource users online

Switch to another languags Deutsch aktuelle Sprache Englisch

PHP Manual


(PHP 4 >= 4.2.0, PHP 5)

pg_copy_from Insert records into a table from an array


bool pg_copy_from ( resource $connection , string $table_name , array $rows [, string $delimiter [, string $null_as ]] )

pg_copy_from() inserts records into a table from rows. It issues a COPY FROM SQL command internally to insert records.



PostgreSQL database connection resource.


Name of the table into which to copy the rows.


An array of data to be copied into table_name. Each value in rows becomes a row in table_name. Each value in rows should be a delimited string of the values to insert into each field. Values should be linefeed terminated.


The token that separates values for each field in each element of rows. Default is TAB.


How SQL NULL values are represented in the rows. Default is \N ("\\N").

Return Values

Returns TRUE on success or FALSE on failure.


Example #1 pg_copy_from() example

pg_connect("dbname=publisher") or die("Could not connect");
$rows pg_copy_to($db$table_name);
pg_query($db"DELETE FROM $table_name");

See Also

Comments to the PHP manual
Write new comment


New Tutorial entries

Migration einer PHP 5 App auf PHP 7

Dieses PHP 7 Tutorial zeigt dir, wie du dein PHP5 Script auf PHP7 umstellst.

Berni | Category: PHP
PHP 7 Virtual Machine

Dieser Artikel zielt darauf ab, einen Überblick über die Zend Virtual Machine, wie es in PHP 7 gefunden wird.

Berni | Category: PHP
plotting masters - a professional guide - Teil II

Grafische Interpolation und Bestapproximation von numerischen Wertepaaren: Wir wollen Punkte auf einer Zeichenebene über verschiedene Verfahren miteinander verbinden.

EVAMasters | Category: PHP