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">
                            <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 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 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 class="heading">
                                Basic Details
                            <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 } ?>
                            <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>

                           <?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 class="clearfix nextPrev displayNone">
                                <div class="leftLabelName">&nbsp;</div>
                                <div class="middleDivider">&nbsp;</div>
                                <div class="RightContent">
                                    <input type="submit" class="previous" value="Previous" />
                                    <input type="submit" class="next" value="Next" />
                    </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
    $this->load->view('template/admin', $data);   
public function startdetails()


$roomTypes =explode(',', $this->input->post('roomType'));   
foreach($roomTypes as $key=>$roomType){
                'interior_client_trans_no_room_id' => $key,
                'interior_house_no_rooms' => $roomType
                echo '<pre>';


$this->db->set('se_erm_client_id', $data);

$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?

Attachments view_form.jpg 56.28 KB
4 Years
Discussion Span
Last Post by cereal

For some reason the variable in line 17 contains an array. Debug that value to see if it's set and read correctly.


Hi Pritaeas, Look in line 21 of the view file that I have posted. Isn't it like a select function dropdown? Like I enter in the master table of 'house'(as in the type of houses, independent, villa, etc etc) I have gotten the values from the database table 'house' to the dropdown. I'm not sure, though. I'm confused tbh. Please explain a bit more, if I'm wrong or I couldn't understand. Thanks for the response.


I understand that at first glance it looks like it should work. That's why I suggested to debug the values involved to see if something has gone wrong.


Line 32:

<option value="<?php echo $ho('interior_house_id');?>"><?php echo $ho['interior_house_desc'];?></option>

Change $ho('interior_house_id') to $ho['interior_house_id'] and it should work. Also I suggest you to use $this->input->post() instead of $_POST since it sanitized by the framework (if $config['global_xss_filtering'] = TRUE;). Bye!

Edited by cereal

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.