Overriding an existing record within a Chronoform

jllav03 18 Nov, 2011
I created a Joomla form that sends out an email with a relevant attachment (like a jpg) and description. The front end works fine, but there's a problem with the back end.

Currently, if I create another email with the same Title, it creates a second record. If the new email has the same Title, I want it to override or replace the current record.

Is that controlled under Form Code with hand typed PHP code, or by updating the field in question within phpMyAdmin?

Thank you for your thoughts.
GreyHead 24 Nov, 2011
Hi jllav03,

You'll need to think carefully through how you want this to work. Record management is done through the primary key column in the record which needs to be an integer - and is usually auto-incremented. If you want to over-write existing records based on the title then you'll need to look up the primary key value and add that to the form data.

Bob
jllav03 02 Dec, 2011
Thanks GrayHead. Regarding this advice:

If you want to over-write existing records based on the title then you'll need to look up the primary key value and add that to the form data.

In my form the ID field, is AUTO-INCREMENTED, I assume that it must also be set to a primary key?

How do I look up the primary key value? Many thanks
GreyHead 02 Dec, 2011
Hi jllav03,

Usually you have the ID anyhow to look up the record. If you only have the title then add a little MySQL query to get the matching ID.

Bob
jllav03 02 Dec, 2011
I have both the ID and TITLE fields. ID is the primary key and AUTO INCREMENTED. But TITLE is the field that I want to overwrite. I may not be able to do it because I can't set TITLE to an INT, and I think primary keys have to be set to INT.

Would a MySQL query still be an option?
GreyHead 11 Dec, 2011
Hi jllav03,

Yes for Joomla! & ChronoForms to work correctly the Primary key needs to be an integer. But if you have the title you can look up the primary key value.

Bob
This topic is locked and no more replies can be posted.