pRieStaKos Posted August 28, 2016 Share Posted August 28, 2016 (edited) I'm trying to copy a row from a table to another table with Laravel Query and I get the following error. $invoice = Capsule::table('tblinvoices')->where('id', $invoiceid)->get(); //array $copiedInvoiceid = Capsule::table('mod_myinvoices')->insertGetId(array($invoice)); Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list' (SQL: ) I've used CREATE TABLE mod_myinvoices LIKE tblinvoices to create mod_myinvoices table. Any suggestions ? UPDATE I switched to $invoice = Capsule::table('tblinvoices')->where('id', $invoiceid)->first(); $copiedInvoiceid = Capsule::table('mod_myinvoices ')->insertGetId((array)$invoice); and works like a charm... Edited August 28, 2016 by priestakos 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.