I have a form which contains some input fields and checkboxes, I want to insert all the values of input in one column (rows).
Here is my form:
<form action="" method="post">
<label>Built in year</label>
<input name="feature[]">
<label>View</label>
<input name="feature[]">
here is my controller:
function create_listing(){
$this->load->view('form');
if($_POST){
$feature = array ( 'feature' => $_POST['feature'] );
foreach($feature as $fkey => $fvalue ){
$this->Mdata->f_detail($fvalue);
}
}
and here is my model:
function f_detail($fvalue){
$this->db->insert('feature',$fvalue);
return $this->db->insert_id();
}
I am getting an error :
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '0, 1, 2) VALUES ('build in year', 'view', 'parking space')' at line 1
INSERT INTO `feature` (0, 1, 2) VALUES ('build in year', 'view', 'parking space')
What's wrong in my code. Anyone please tell me .
Regards