我想在我尝试添加时将数据插入到我的数据库中,因为 [^/]+ # Not forward slash char's
(?= /? $ ) # Lookahead, optional / then EOS
是product_id
,然后向我显示这样的错误,我需要逐个添加它,但是如果我有array
等,我想完全添加它们,如何在我的2 , 3 , 4 , 10+ etc
中迭代foreach
添加它们?
model
我的控制器:
Operand should contain 1 column(s)
INSERT INTO storelte_notifications (message,type,product_id,user_id,timestamp) VALUES('low stock', 'low stock', ('4170','4171'), 1, 1500579824)
我的模特
<?php
public function tests() {
$array = $this->sale->get_all_cart($this->session->carrito);
foreach ($array as $key => $value) {
$product_id[] = $value['id'];
}
$entryData = array(
'message' => 'low stock',
'product_id' => $product_id,
'user_id' => 1,
'type' => 'low stock',
'timestamp' => time()
);
$this->notification->addNotification($entryData);
}
?>