Re: use fopen unknown resource

From: ourdiaspora <ourdiaspora(at)protonmail(dot)com>
To:
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: use fopen unknown resource
Date: 2021-08-27 22:50:31
Message-ID: FPQBkGZpsb1CdQX5UIFJTWTaTpYa6spcn_LR3KD6ylvpyWRerxZ9O19SP0zICAwtxta9Wzq5vc1VfKdlWVUXUy8kMaL8OzwbElhBB31WszQ=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Friday, August 27th, 2021 at 11:10 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:

> https://www.php.net/manual/en/pdo.pgsqlcopyfromfile.php
>

"
public PDO::pgsqlCopyFromFile(
string $table_name,
string $filename,
"

Sorry but do not understand; the line does not explain what to write in the php file.

So far have written:
"
<?php
$userfile=file(./
$dbusertemporary = pg_connect("dbname=cpacweb user=cpaca");
$usertemporarydata = pg_copy_from (
resource $dbusertemporary,
string $userdata,
array $rows,
string $delimiter = ',',
string $null_as = '\\N'
): array;
"

The plan is to write an html file for a user to select a csv file to import into a database. The manual suggests that the file name is already known (e.g. https://www.php.net/manual/en/function.fgetcsv.php)

Instead of:
"
...
fopen("test.csv", "r"))
...
"

it would _not_ be possible to write, correct?:
"
...
fopen("", "r"))

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-08-27 22:51:02 Re: Can we get rid of repeated queries from pg_dump?
Previous Message Stephen Frost 2021-08-27 22:27:20 Re: Can we get rid of repeated queries from pg_dump?