Welcome Guest, Not a member yet? Register   Sign In
MySQL foreign key Value insert
#1
Exclamation 
(This post was last modified: 12-10-2014, 10:15 AM by rushdi1987.)

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
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




Theme © iAndrew 2016 - Forum software by © MyBB