• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MySQL foreign key Value insert

#1
Exclamation 
I made two tables

Table Name                        Column Name

debit ->   id (primary key), accountname , vid (foreign key reference to  voucher.id)
voucher -> id (primary key), voucher_no, 


I want to add voucher id no as the vid field.  How do I do that with codeigniter ??? Do i need to use LAST_INSERT_QUERY(),  custom fucntion? Please help me.

Exclamation


Attached Files
.zip   ci-journal.zip (Size: 635.25 KB / Downloads: 129)
Reply

#2
Hello,

I'm not sure about what you need, so can you please explain more clearly your problem ?

Can you post your controller/model/view code ?

Maybe I'll can help you then... Thanks !
Reply

#3
I think $this->db->insert_id(); will solve your problem

check this URL: http://www.codeigniter.com/userguide3/da...lpers.html
Reply

#4
Files uploaded. i want to insert all data at once.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.