CSV Import error
CSV Import error
Hi
Question 1:
I am trying to import the data using CSV file upload.
I have uploaded the steps involved in process, at step-3 for some reasons it display value 2 (dont know why). Tried deleting and adding names/columns but no change.
Step -1:
step-2:
step-3:
**Question 2:
**
I have a compound key in one of my tables and on serverside the key looks like:
$editor = Editor::inst( $db, 'contract_return_firm', array('product_code', 'member_name') )
and when I try to import data it shows this error :
When inserting into a compound key table, all fields that are part of the compound key must be submitted with a specific value
and not sure how can I fix this
Answers
Well you need to submit "product_code" and "member_name" to the server. Looks like you don't do this. "member_name" may correspond with "First Name" or "Last Name", but nothing seems to correspond with "product_code" ...
Looks like your database table "contract_return_firm" isn't suitable to import data like this from the client. So either you change your db table or you change the form to be imported.
@rf1234
Thank you I tried to do same and error still remains there
Step - 1: this is how my csv file looks like
Step 2: mapping the fields after CSV import
Step 3: this shows same error
Also, tried to do import on a diffwerent table (without compound keys) and it shows the same error ast step -3, where 2 gets displaye din each box.
this might help:
on my serverside my code looks like this:
on client side:
The code for CSV Import looks same as used in example on website
Thanks
Are you able to link to your page so we can take a look?
Colin
@colin I am not sure if I can link an example, as I am working on local host and retrieving data from database. However, I have created an simple example and posted all the code below :
admin.php (client side code is this)
The code on serverside (admin_fetch.php) looks like this:
And when I try to import the CSV file , it gets loaded but on
1) My table looks like thhis , in begining
2) data on csv file looks like thgis
3) when uploading on screen it looks like
4) the problem is in this step, the data look like this
5) and this gets uploaded and final table looks like thgis:
@colin
I managed to sort it out.
Apparently , from the server side you need to change it
and on client side use
This sorted one of the issues but when inserting data in compound key table, this error is still there
Exception: When inserting into a compound key table, all fields that are part of the compound key must be submitted with a specific value. in C:\wamp64\www\Editor-PHP-1.9.4\lib\Editor.php on line 2253
@colin
Please ignore my all comments, I have sorted it out
Excellent, glad all working, thanks for reporting back,
Colin