Forums

How to get auto increment primary key from "save data" action

kittisak 6d ago

Hi Max,

Could you tell me how to get auto increment primary key from "save data" action? I need to use the new record's auto increment primary key for save as the second table data.

Regards,

Kittisak

Max_admin 6d ago
Answer
1 Likes

Hi Kittisak

Use the {var:save_data_name.id} shortcode or use PHP:

$this->get("save_data_name.id")

the exact name and "id" field name depends on your save data and table, so check the form debug for that

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kittisak 6d ago

Hi Max,

I had check debug but they do not have id data in save_data action. 

Regards,

Kittisak

Pkoll 6d ago
2 Likes

Don't forget to set in behaviors from the save the Primary Key on and the the name "id" from the table!

Paul

Max_admin 6d ago
1 Likes

Hi Kittisak

As Paul has noted, you need to set the primary key in the Save Data behaviors, I forgot this step

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
kittisak 6d ago
1 Likes

Thank you very much Paul and Max. It's work now.

You need to login to be able to post a reply.

VPS & Email Hosting 20% discount

{item:title} {images:#}