What I need:
- I send a id_code.
- if the record (of that id_code) exist, edit it.
- if not, edit then insert it.
Well, I didn't managed to do it. I tried to, if the record didn't exist, define the value of this DB Field. Ok, I set it, but then the recor tried to UPDATE instead of INSERT.
Back to the start.
How to
- if the record (of that id_code) exist, edit it.
- if not, edit then insert it.
- I send a id_code.
- if the record (of that id_code) exist, edit it.
- if not, edit then insert it.
Well, I didn't managed to do it. I tried to, if the record didn't exist, define the value of this DB Field. Ok, I set it, but then the recor tried to UPDATE instead of INSERT.
Back to the start.
How to
- if the record (of that id_code) exist, edit it.
- if not, edit then insert it.
Hi rslyra,
I would have two columns in my table to handle this - one is a auto-incremented primary key - the cf_id column in a ChronoForms created table; and the second a column for the id_code.
Then on submit you can look up the id_code in the table, if it exists, get the cf_id and add that to the $form->data['cf_id']. The add a DB Save and it will update the exisiting record, or create a new one correctly.
Bob
I would have two columns in my table to handle this - one is a auto-incremented primary key - the cf_id column in a ChronoForms created table; and the second a column for the id_code.
Then on submit you can look up the id_code in the table, if it exists, get the cf_id and add that to the $form->data['cf_id']. The add a DB Save and it will update the exisiting record, or create a new one correctly.
Bob
This topic is locked and no more replies can be posted.
