Welcome Guest, Not a member yet? Register   Sign In
[newbie] $this->db->insert(); problem
#1

[eluser]Ingonyama[/eluser]
Hi, Im trying to use the insert method but its looking for a "submit" column in the database (obviously from the submit button).

Error message is:
"Unknown column 'submit' in 'field list'"
INSERT INTO `categories` (`name`, `description`, `submit`) VALUES ('test', 'test123', '')

Controller:
Code:
function add_category()
    {
        $data['heading'] = 'Add category';
        
        if ($_POST)
        {
            echo 'Post submitted<br />';
            print_r($_POST);
            $this->db->insert('categories', $_POST);
        }
        
        $this->load->view('admin/categories/add_category', $data);
    }

View:
Code:
<h1>&lt;?php echo $heading; ?&gt;</h1>
&lt;?php echo form_open('admin/add_category'); ?&gt;
<dl>
    <dt><label for="name" id="name_label"></label></dt>
    <dd>&lt;?php echo form_input('name'); ?&gt;</dd>
    <dt><label for="description" id="description_label"></label></dt>
    <dd>&lt;?php echo form_input('description'); ?&gt;</dd>
    <dd>&lt;?php echo form_button('submit', 'Submit'); ?&gt;</dd>
</dl>
&lt;?php echo form_close(); ?&gt;

Thanks for any help.


Messages In This Thread
[newbie] $this->db->insert(); problem - by El Forum - 09-25-2008, 06:41 AM
[newbie] $this->db->insert(); problem - by El Forum - 09-25-2008, 06:54 AM
[newbie] $this->db->insert(); problem - by El Forum - 09-25-2008, 07:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB