How to create autoincrement field

Yudhizth 29 Oct, 2014
Hi,

How to create autoincrement by using 2 table that have relation. I'm using 2 tables.

The selected column in the picture is needed autoincrement.

Thanks
GreyHead 30 Oct, 2014
Hi Yudhizth,

I'm sorry, I don't understand your question :-(

Auto increment is managed by MySQL when a new record is created.

If you want to link two tables then you need to set the column names to the same value for both DB Save actions.

Bob
Yudhizth 31 Oct, 2014

Hi Yudhizth,

I'm sorry, I don't understand your question :-(

Auto increment is managed by MySQL when a new record is created.

If you want to link two tables then you need to set the column names to the same value for both DB Save actions.

Bob



Make it simple, is chronoform have autoincrement feature (php script, etc) without using autoincrement from MySQL.?
Because I'm not expert with php, I'm Java 🤣
GreyHead 31 Oct, 2014
Hi Yudhizth,

There is nothing included in ChronoForms. It is possible but you have to solve two problems:

a) You have to store the last used id somewhere. Either in a database table; or it can be stored in a plain text file.

b) You have to make sure that the id is unique - there is a possible problem if two users submit the form at the same time and both get the same id. That's not likely but it is possible. The best solution to this one is to link your id to a database table id and let MySQL manage the uniqueness.

Bob
indigo1987 21 Oct, 2015
Hello,

I was reviewing this forum and I need to have a field which auto increments its value. Can you please show the steps in order to link a field to a database table id in order to have a autoincrement field in my form?

Thanks in advance,

David
GreyHead 22 Oct, 2015
1 Likes
Hi David,

After a DB Save action ChronoForms adds the new record ID to the $form->data[''] array so you can use that in later actions. Does that do what you need?

Bob
indigo1987 23 Oct, 2015
Hi Bob,

Thanks for your help. I worked just fine!!

Kind regards,

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