I have to sync with two tables in the database
The following is the error I get:
A database error has occurred
Error Number: 1054
Unknown column 'Array' in 'field list'
INSERT INTO client
(interior_client_name
, Interior_client_email
, interior_client_mobile
, interior_house_id
) VALUES ('a', 'b', '8989898', Array)
Filename: C:\xampp\htdocs\ThinkInterio\system\database\DB_driver.php
Line Number: 330
These are the two tables as shown below :
The view file template is as follows:
<form id="formID" class="formular" method="post" action="<?php echo base_url(); ?>admin/startdetails" enctype="multipart/form-data">
<!-- Start Content Start -->
<div class="visualizeContent" style="display:block;" id="start">
<h1>Start</h1>
<ul>
<li class="heading">Client Details</li>
<li class="clearfix">
<div class="leftLabelName">Client Name</div>
<div class="middleDivider">:</div>
<div class="RightContent"><input type="text" name="interior_client_name" class="validate[required]"/></div>
</li>
<li class="clearfix">
<div class="leftLabelName">Client Email ID</div>
<div class="middleDivider">:</div>
<div class="RightContent"><input type="text" name="Interior_client_email" class="validate[required]"/></div>
</li>
<li class="clearfix">
<div class="leftLabelName">Client Contact Number</div>
<div class="middleDivider">:</div>
<div class="RightContent"><input type="text" name="interior_client_mobile" class="validate[required]" /></div>
</li>
<li class="heading">
Basic Details
</li>
<li class="clearfix">
<div class="leftLabelName">House Type</div>
<div class="middleDivider">:</div>
<div class="RightContent">
<select name="interior_house" id="interior_house_desc" class="validate[required]">
<option value="">Please select</option>
<?php foreach($house as $ho){ ?>
<option value="<?php echo $ho('interior_house_id');?>"><?php echo $ho['interior_house_desc'];?></option>
<?php } ?>
</div>
</li>
<li class="clearfix">
<div class="leftLabelName"><strong>Carpet Area</strong></div>
<div class="middleDivider"></div>
<div class="RightContent"><input type="text" name="Interiror_client_carpet_area" class="validate[required]"/></div>
</li>
<?php foreach($roomtype as $co){
?>
<li class="clearfix">
<div class="leftLabelName"><?php echo $co['interior_room_desc']?></div>
<div class="middleDivider">:</div>
<div class="RightContent"><input type="text" name="roomType[<?php echo $co['interior_room_id']?>]" /></div>
</li> <?php } ?>
<li class="clearfix">
<div class="leftLabelName">Upload Floor Plan <small style="color:#A4A3A3;">(Max 1MB)</small></div>
<div class="middleDivider">:</div>
<div class="RightContent"><input type="file" /></div>
</li>
<li class="clearfix nextPrev displayNone">
<div class="leftLabelName"> </div>
<div class="middleDivider"> </div>
<div class="RightContent">
<input type="submit" class="previous" value="Previous" />
<input type="submit" class="next" value="Next" />
</div>
</li>
</ul>
</div><!-- Start Content End -->
My functions are as follows in the controller, can anyone help me with what has gone wrong? I have to post values in those two tables, and I have tried something on the lines of those. below
public function starting()
//start in interior table
{
$data['house']=$this->db->get('house')->result_array();
$data[]=$this->db->get('rooms')->result_array();
$data['body_content']='template/client';
$this->load->view('template/admin', $data);
}
public function startdetails()
{
echo"<pre>";
print_r($_POST);
$data['interior_client_name']=$_POST['interior_client_name'];
$data['Interior_client_email']=$_POST['Interior_client_email'];
$data['interior_client_mobile']=$_POST['interior_client_mobile'];
$data['interior_house_id']=$_POST['interior_house'];
$this->db->insert('client',$data);
$roomTypes =explode(',', $this->input->post('roomType'));
$startid=$this->db->insert_id();
print_r($startid);
print_r($roomTypes);
foreach($roomTypes as $key=>$roomType){
$clientData=array(
//'interior_client_trans_ref_id'=>'client.interior_client_trans_ref_id',
'interior_client_trans_no_room_id' => $key,
'interior_house_no_rooms' => $roomType
);
$this->think_model->insert('client_trans',$clientData);
echo '<pre>';
print_r($clientData);
}
echo"<pre>";print_r($data);exit;
$this->db->set('se_erm_client_id', $data);
/*
$rdata['interior_house_no_rooms']=$_POST['bedroom'];
$rdata['interior_house_no_rooms']=$_POST['living'];
$rdata['interior_house_no_rooms']=$_POST['dining'];
$rdata['interior_house_no_rooms']=$_POST['pooja'];
$rdata['interior_house_no_rooms']=$_POST['kitchen'];
$rdata['interior_house_no_rooms']=$_POST['washroom'];
$rdata['interior_house_no_rooms']=$_POST['balcony'];
$rdata['interior_house_no_rooms']=$_POST['utility'];
$rdata['interior_house_no_rooms']=$_POST['other'];
$this->db->set('interior_house_no_rooms', $startid);
$this->db->insert('client_trans',$rdata); */
foreach($_POST['user'] as &$user)
{
// $user['additional_data'] = $_SESSION['additional_data'];
// $user['current_time'] = time();
$this->db->insert('client_trans', $user);
}
}
I have attached the file view, as in how it looks. Please help me, as to how to?