Failed to Import

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
juniorpinto
User
Posts: 48

Failed to Import

Post by juniorpinto »

v2023, when trying to load data through the import function from an excel sheet, nothing is loaded despite advancing the primary key value. It is as if the data has been loaded and then deleted.


arbei
User
Posts: 9286

Post by arbei »

You need to press the "Save" button (see the Improved Data Import) to save, alse see the advanced setting Import records with transaction.


juniorpinto
User
Posts: 48

Post by juniorpinto »

In my case... not show the buton save and dont load all.


arbei
User
Posts: 9286

Post by arbei »

Then you should enable Debug to check server side errors in the log file on your server, and also check HTTP response in your browser.


SRanade
User
Posts: 95

Post by SRanade »

Import will fail if you have fields that are empty and the table requires non-NULL values. In such case you can manually assign values when the fields are blank. Then import works.

Similarly import will fail if data length in imported field is longer than the field size in database.

You have to ensure data integrity on your own to ensure that rows are accepted.

Try to enable Import records with transaction (in advanced settings) to see the list of data rows with indication of failed rows.

I think internally PHPMaker tries to save the row to database, and if it gets an error message of any kind, it considers the import as failed without giving you the reason.

Once I set all null or blank or extra-long values manually in Row_Import, everything works beautifully.

For example:

function Row_Import(&$row, $cnt)
{
    Log($cnt); // Import record count
    Log(print_r($row, true)); //raw row data. Won't reveal NULL values

    //ensure non-NULL values
    if (strlen(trim($row["first_name"])) < 1) $row["first_name"] = "";
    if (strlen(trim($row["last_name"])) < 1) $row["last_name"] = "";
    if (strlen(trim($row["email"])) < 1) $row["email"] = "";
    $row["password"] = ""; //password is null as there is no data on this in import file, so set it to non-NULL
    return true;
}

arbei
User
Posts: 9286

Post by arbei »

Note that you may check HTTP response to see the result of each record with success or error message. The results are under the Network -> EventStream panel.


juniorpinto
User
Posts: 48

Post by juniorpinto »

The problem was my Xampp server. To solve I needed to configure:
zlib.output_compression=off


bui
User
Posts: 277

Post by bui »

My table engine is InnoDB
Import is inserting the data correctly but I did not get the option/button to SAVE .
Only CLOSE button is showing.

How can I bring the SAVE button.


mobhar
User
Posts: 11660

Post by mobhar »

You might need this: Advanced Settings for Import.


Post Reply