Page 3 of 3
Re: Is it possible to import data into a subform from a file
Posted: Tue Jun 09, 2020 3:27 pm
by kknm
Janusz wrote:the current form Primary key can be easilly sent from JS to PHP and used in mysql
so you collect data from excel; adding the current record Primary key, inserting data to table and thats all
Code: Select all
//get id of the current main record (JS)
var id=nuGetProperty('record_id');
// prepare to be available in php (JS)
nuSetProperty('CON_PART_ID', id);
//recover and use in PHP (PHP)
$pid=('#CON_PART_ID#');
$uid=nuID();
$x="INSERT INTO connection (connection_id,con_part,con_rap) VALUES ('$uid','$pid','$rap_id')";
and for adding subform unique id use nuID(); (for more records - in the loop - every line - has to have new nuID generated)
I became interested, but in your code I do not find the file name to import and work with the file.What is important - to use php-funсtion should be an unprivileged user.
Re: Is it possible to import data into a subform from a file
Posted: Tue Jun 09, 2020 3:41 pm
by Janusz
i do not use in my application php data import from the file so do not have ready example to share - but normally within php it should be easy to read data from external files - depandind on data fromat etc.
just few examples:
https://phppot.com/php/import-excel-fil ... 0by%20row.
https://phpenthusiast.com/blog/parse-csv-with-php
Re: Is it possible to import data into a subform from a file
Posted: Tue Jun 16, 2020 2:39 pm
by kknm
Janusz wrote:i do not use in my application php data import from the file so do not have ready example to share - but normally within php it should be easy to read data from external files - depandind on data fromat etc.
Thanks for the valuable advice. I had to be perverted, because I don’t have all the rights to the resources of a mixed (Linux-windows) local area network. I used php, smbclient, phpExcel to write directly to the mysql database according to your advice. Of course, this is unsafe, but it eliminates unforeseen errors from the database users.