这些是我想插入到数据库中的值:
$name4 = $request['name4'];
$email4 = $request['email4'];
$phone = $request['phone'];
$cat = $request['cat'];
$rname = $request['rname'];
$file = $request['file'];
$ingr = $request['ingr'];
$qty = $request['qty'];
$unit = $request['unit'];
$recp = $request['recp'];
$items = array(
'ingredients' => $ingr,
'quantity' => $qty,
'unit' => $unit
);
插入查询如下:
DB::INSERT("insert into tbl_contest (name, email, phone, category, recp_name, file, ingredient, recp_desc)" . "values('$name4','$email4','$phone','$cat','$rname','$file','$items','$recp')");
我想添加$ingr
,$qty
并添加$unit
到列中ingredient
。
谁能帮我?
提前致谢
$items 变量不能是数组,可以转成json字符串。
$items= json_encode(array(
'ingredients' => $ingr,
'quantity' => $qty,
'unit' => $unit
));
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句