【发布时间】:2020-05-03 10:32:04
【问题描述】:
我有一个像
这样的数组array:5 [▼
188 => array:17 [▼
"user_id" => "176"
"product_id" => "188"
"qty" => "2"
"date" => "03-05-2020"
"product_type" => "rear type"
"custom_color_title" => ""
"custom_color_price" => ""
"bolt_title" => ""
"bolt_price" => ""
"hub_center_rings_title" => ""
"hub_center_rings_price" => ""
"wheel_spacers_title" => ""
"wheel_spacers_price" => ""
"tire_pressure_title" => ""
"tire_pressure_price" => ""
"product_price" => 1890
"product_size" => ""
]
176 => array:17 [▼
"user_id" => ""
"product_id" => "176"
"qty" => "2"
"date" => "03-05-2020"
"product_type" => "wheel type"
"custom_color_title" => ""
"custom_color_price" => ""
"bolt_title" => ""
"bolt_price" => ""
"hub_center_rings_title" => ""
"hub_center_rings_price" => ""
"wheel_spacers_title" => ""
"wheel_spacers_price" => ""
"tire_pressure_title" => ""
"tire_pressure_price" => ""
"product_price" => 1680
"product_size" => ""
]
224 => array:17 [▶]
]
从一个会话变量这个数组 和mysql表字段是id、name、img等。如何加入array.product_id和table.id,
我的查询如$table=DB::select('SELECT * FROM products');我在 laravel 中以任何方式加入 mysql 表和数组?
【问题讨论】:
-
我真的不明白你的问题。
-
@ÖmerYilmaz 我有一个来自会话变量的数组,我想加入数组和 mysql 表,无论如何?
-
请编辑您的问题,将数组写入数组(而不是转储)和 mysql 查询或结果,然后写出您想要的内容。我会帮你的。
-
@ÖmerYilmaz 我将编辑我的问题