⚠ In case you've missed it we are migrating to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠

Insert data into two tables at the same time

tables multiple insert

  • Please log in to reply
1 reply to this topic

#1 Sebastián



  • Members
  • Pip
  • 4 posts

Posted 07 May 2014 - 12:40 AM

Hi people,

I'm working on a real estate project and I traying to appy an inheritance, saving the common data into the PROPERTY table, and the specific daata into the others tables (HOUSE, APARTMENT, etc) so I have a problem trying to insert data into two different tables at the same time.

The tables are Property and House:


  • property_id
  • property_name
  • property_city
  • property_price


  • house_id
  • property_id
  • house_bedrooms_qty
  • house_bathrooms_qty


I want to view JUST ONE CREATE FORM for these two tables and insert the data into each one.
Is this possible?

Thanks a lot for your help!
Best regards


#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts

Posted 07 May 2014 - 05:45 AM

Well yes it is quite possible with 1 single form - you need to use - set_field to set all the fields ... u might need to use change_field_type - to define the field types if required and then add a callback_insert where it will 1st insert data into primary table and then into secondary table.

Have done it the same way for my project and works like a charm


Happy GCing:)

Also tagged with one or more of these keywords: tables, multiple insert

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users