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.
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.
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
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
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
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
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
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
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?
Would a MySQL query still be an option?
This topic is locked and no more replies can be posted.