Re: postgresql csv import

[email protected] (Ashley Sheridan)
Newsgroups php.general
Message-ID <[email protected]>
On 16/09/2021 21:30, ourdiaspora wrote:
> Readers,
>
> Please excuse, but very confused the options available; none seem easy to understand. Tried:
>
> Readers,
>
> Please could someone help to explain why the following code fails:
>
> <?php
> 	$uploaddir = '~/tmp/cpac/cpactmp/';
> 	$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
> 	$dbconnect = pg_connect("dbname=cpacweb user=cpaca");
> 	$targetfilepath = $uploaddir . $uploadfile;
> 	if(isset($_POST["submit"])){
> 		$dbconnect = "INSERT INTO somedata(name, id, emailaddress, groupname) VALUES ('jane bloggs','1234','[email protected]','1a1')";
> 		}
> 	$query = "SELECT * FROM somedata";
> 	$result = pg_exec($dbconnect, $query);
> 	echo "Number of rows: " . pg_numrows($result);
> 	pg_freeresult($result);
> 	pg_close($dbconnect);
> ?>
>
> The web page reports:
> "
> Number of rows: 0
> "
>
> This suggests successful connection to the database, but some failure to enter new data.
>
> sudo nano /etc/php/7.0/apache2/php.ini
>
> "
> ...
> [line number]483 log_errors = On
> ...
> 571 error_log = ~/tmp/webserver/phperrors.log
> ...
>
> The directory does not show creation of such an error file to interrogate further. Please what next to investigate?
Again, what does your error log tell you?

-- 
Ashley Sheridan
https://www.ashleysheridan.co.uk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.