Re: postgresql csv import

From: Date: Sun, 19 Sep 2021 17:49:32 +0000
Subject: Re: postgresql csv import
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-327711@lists.php.net to get a copy of this message
On Thursday, September 16th, 2021 at 9:30 PM, ourdiaspora <ourdiaspora@protonmail.com> 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.

« previous php.general (#327711) next »