0

Greetings, i have this code that inserts an item on the table item_tbl and it should also get the added items primary key and insert it on table fields_tbl.

My question is how can i get the primary key of the item that i will add and insert it on the fields_tbl.

(item_tbl's primary key is a foreign key on fields_tbl)

DB::table('item_tbl')
                ->insert(array('item_name' => $data['itemTb']));

            foreach($_POST["mytext"] as $labelField) {
                DB::table('fields_tbl')
                    ->insert(array('label' => $labelField));
            }
            return Redirect::back();
2
Contributors
2
Replies
10
Views
2 Years
Discussion Span
Last Post by Jake.20
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.