I created a normal HTML form with 10+ fields. One of the fields is the submit button (obviously nobody wants to store it in database). I'm trying to save data in the table with this statement in the Product model:
In controller:
$id = Product::saveFormData(Input::all());
In model:
$id = DB::table('products')->insertGetId($data);
It is giving me the following error:
Column not found: 1054 Unknown column 'btncreateproduct' in 'field list' (SQL: insert into
products
(name
,url_key
,sku
,quantity
,price
,specialprice
,description
,preorder
,page_title
,header_data
,custom_json_data
,btncreateproduct
,category_id
) values (abc, aaa, bbb, 11, 2222, 1111, abcasdf, no, asdf, asdf, asdf, Create Product, 2))'
Now, first of all, why it is considering btncreateproduct
as a field. I do not want to specify the list of fields in my model as I want this code to be scalable (user can add any number of fields).
Secondly, the values abc, aaa are not like 'abc', 'aaa'
Which means at the current moment, it is not considering them as string values. Although they are defined varchar in the database.