Re: postgresql csv import

[email protected] (ourdiaspora)
Newsgroups php.general
Message-ID <Gq8ESGBi3fT0o7iFmbQpe4-YIbstgOMZ-Q_qRXtERmy3fe2vYY1POSfgkWs33V4Ss15PoyuvWcfsVx7rg7biH4L39VRYWPZSJLh9lkYE_CQ=@protonmail.com>
On Thursday, September 16th, 2021 at 9:30 PM, ourdiaspora <[email protected]> wrote:
>
> 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?

Readers,

Continuation of failures occurs:

<?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"])){
		$filename=$_FILES["userfile"]["tmp_name"];
		if($_FILES["file"]["size"] > 0){
			$file = fopen($filename, "r");
			while (($getdata = fgetcsv($file, 10000, ",")) !== FALSE){
				$dbdataentry = "INSERT INTO somedata(name, id, emailaddress, groupname) VALUES ('".$getdata[0]."','".$getdata[1]."','".$getdata[2]."','".$getdata[3]."')";
				}
			$result = pg_query($dbconnect, $dbdataentry);
			}
			fclose($file);
		 }
	$query = "SELECT * FROM somedata";
	$result = pg_exec($dbconnect, $query);
	echo "Number of rows: " . pg_numrows($result);
	pg_freeresult($result);
	pg_close($dbconnect);
?>

Connection to the database is successful, but not csv import and subsequent data entry.

As posted previous, also do not understand why error logs are not being produced. Please what to do?

The file 'phpinfo()' shows:
"
...
error_log	-1	-1
...
"

The error log is not produced.
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.