This topic is locked

Import all records (update)

3/17/2010 2:30:52 PM
PHPRunner General questions
L
lordkain2 author

Hi, how I could make an update to all records using import function (only 3 fields I want to update)? Or other way to update all records?
Thanks.

Sergey Kornilov admin 3/17/2010

Need some clarification.
To update all records you can insert a button (PHPRunner 5.2) and execute update SQL query there. Not sure if this is what you looking for.

L
lordkain2 author 3/17/2010



Need some clarification.
To update all records you can insert a button (PHPRunner 5.2) and execute update SQL query there. Not sure if this is what you looking for.


I have this table: ID, Name, Savings, Loans. Every month I need to update Savings and Loans for the current clients, and insert the new clients from an Excel file, I was wondering if I could use the Import function of PHP for that, I tried and got this error:
DB error: Duplicate entry 'x' for key 'PRIMARY';
Any ideas?

Sergey Kornilov admin 3/18/2010

Thanks, makes sense.
I recommend to upload your project to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL and attaching Excel file in question.

L
lordkain2 author 3/18/2010

Thanks, I found the solution, just change in line 469 of TABLE_import.php from this:

$sql = "insert into ".AddTableWrappers($strOriginalTableName)." (".implode(",", $fields_list).") values (".$values_list.")";


to

$sql = "replace into ".AddTableWrappers($strOriginalTableName)." (".implode(",", $fields_list).") values (".$values_list.")";


The only problem is that I need to change the file every time I build, can you help me?

Sergey Kornilov admin 3/20/2010

If you need to alter default import behaviour use 'Before Insert Record' event on the import page. This is really the best way and your changes won't be lost after rebuild.