I get the following error:
A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: models/Bulk_Recipeis_model.php
Line Number: 32
This my code in the model:
public function insert_order($user, $recipies, $quantity, $date, $time, $totalbill)
{
$this->db->trans_start();
foreach($quantity as $key => $user_quantity) {
$this->db->query("UPDATE bulk_delivery SET max_quantity = max_quantity - '$user_quantity'");
$this->db->query("INSERT INTO bulk_delivery_order (id, user_quantity, date,time,total_bill,bulk_delivery_id) VALUES ('$user', '$user_quantity', '$date', '$time', '$totalbill', '$recipies')");
}
$this->db->trans_complete();
}
My code in the controller:
public function get_insert_order(){
$user = $this->userId;
$recipies = $this->input->post('bulk_delivery');
$quantity = $this->input->post('quantity');
$date = $this->input->post('date');
$time = $this->input->post('time');
$totalbill = $this->input->post('bill');
$this->bulk_recipe->insert_order($user, $recipies, $quantity, $date, $time, $totalbill);
redirect('BulkRecipe_Controller');
}
It's in my view where I used array data:
<input type="hidden" name="bulk_delivery[]" value="<?php echo $row->bulk_delivery_id;?>" >
<input type="text" name="quantity[]" step="1" class="container" value="" onfocus="this.value = '';" onblur=";" style="width: 60px">
Please tell me how to resolve this error.