⚠ In case you've missed it, we have migrated 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 is an archived forum. ⚠

  •     

profile picture

insert with same value



peterf
  • profile picture
  • Member

Posted 10 March 2013 - 20:09 PM

I have a second question:

i have a table with customer

 

customer

==========

id   name

 

 

and a table with sales

 

sales

=================

customer_id    item

 

 

When i show sales,

i can select a customer for all next insert?

I.e., i choose a customer, Bill.

When i show table sales, i can insert (with code) same customer, Bill, until i choose another one?

Thank you


davidoster
  • profile picture
  • Member

Posted 11 March 2013 - 01:16 AM

Try to use the before_insert function, http://www.grocerycrud.com/documentation/options_functions/callback_before_insert


peterf
  • profile picture
  • Member

Posted 11 March 2013 - 06:57 AM

Try to use the before_insert function, http://www.grocerycrud.com/documentation/options_functions/callback_before_insert

 

OK, thank you.

But, how i know the previous value to insert again?

With same tables in my first post, how i can know what customer user have choosen?

thank you very much.


davidoster
  • profile picture
  • Member

Posted 11 March 2013 - 11:18 AM

http://www.grocerycrud.com/documentation/options_functions/callback_after_insert