Re: postgresql csv import

[email protected] (Ashley Sheridan)
Newsgroups php.general
Message-ID <[email protected]>

On 20 September 2021 22:49:25 BST, ourdiaspora <[email protected]> wrote:
>> So what exactly is your code doing? Check each part:
>>
>
>The problem experienced is the very low knowledge and comprehension. It has been difficult even to access the error logs!
>
>> 1. Is the uploaded file actually detected with a size over 0 bytes?
>
>Don't know how to verify; command terminal 'du -sh' shows the file size to be 4 kb.

That doesn't mean it was uploaded successfully or that it had a valid size
>
>> 2. Are you able to successfully open it for reading?
>
>Not sure this is understood; can open the csv file using my text editor.

Can your code open it though? What is the return value from opening the file in read mode?
>
>> 3. Is it even a valid CSV that can be read with fgetcsv() ?
>
>Again, don't know how to verify, but libreoffice calc shows a valid csv file that can be opened in the spreadsheet

That just means it's something that Libre can understand, it doesn't mean it's a valid CSV.
>
>> 4. Does it loop over the data the expected number of times?
>
>Again, I don't have the knowledge to test this

Print statements inside the loop at the most basic level.
>
>> 5. Is the CSV data constructed in the right way that your $getdata
>> indexes are correct when you build the query?
>
>Think so, assuming the index [0] corresponds to the first field.

Did you attempt to use any kind of simple print statement debugging to see if any of your assumptions are correct?
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.