In my Laravel Controller, I'm importing csv to my db, I query SQL get products_name and then insert product_name to my order table. The CODE work Perfect on my xampp server, it was when I deploy to live server (Cpanel) that I gives Error.
$products_name = DB::table('products_description')
->where('products_id','=', $importData[0])->pluck('products_name');
OrdersProduct::create(
array
(
"products_id"=>$importData[0],
"products_name"=>$products_name[0],
"products_quantity"=>$importData[1],
)
);
My Larevel Log is showing Error Msg: production.ERROR: Undefined offset: 0
When I used RETURN $products_name[0], It displays the Product Name... but when I tried to Create OrderProducts, it generate error. Note there is content is the products_name and it work fine on my localhost, only when I deployed to server I get error.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire