Welcome Guest, Not a member yet? Register   Sign In
Catch DB error
#2

You should validate the results.

I would suggest creating another table with just 2 colums: "column_name", "validation_rules". For each column in your original database you place one entry in the new table with a validation string (like: "required|greater_than[10]").

Now when you read the CSV you can check if the presented key (first row of CSV) exists in the validation table, if it does you can use the validation_rule to validate the value (other rows in CSV).

If it's valid then you can insert the data safely, if its not valid you could skip that file, only the row or send oud an email etc.
Reply


Messages In This Thread
Catch DB error - by ComputingFroggy - 01-21-2016, 06:15 PM
RE: Catch DB error - by Diederik - 01-22-2016, 01:33 AM
RE: Catch DB error - by josepostiga - 01-22-2016, 02:40 AM
RE: Catch DB error - by ComputingFroggy - 01-22-2016, 05:40 AM
RE: Catch DB error - by josepostiga - 01-22-2016, 05:49 AM
RE: Catch DB error - by ComputingFroggy - 01-22-2016, 06:41 AM
RE: Catch DB error - by ComputingFroggy - 01-22-2016, 08:18 AM
RE: Catch DB error - by Shawn - 01-27-2016, 06:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB