Welcome Guest, Not a member yet? Register   Sign In
Error 1054
#1

[eluser]ealonw[/eluser]
Can anyone tell me what this means?



Error Number: 1054

Unknown column '_ci_scaffolding' in 'field list'

UPDATE usercomment SET _ci_scaffolding = 1, _ci_scaff_table = 'usercomment', id = NULL, fname = NULL, lname = NULL, email = NULL, comment = NULL WHERE 0 = 'id' AND 1
#2

[eluser]gtech[/eluser]
[url="http://ellislab.com/forums/viewthread/46694/"]http://ellislab.com/forums/viewthread/46694/[/url]

The problem with the models userguide section is that it suggests to pass $this to the update, however when you pass this you are also passing _ci_scaffolding to the insert, as extending from model includes these values for scaffoliding.

so do not pass $this to any active record functions, it is bad practice

documentation example
Code:
function update_entry()
{
    // yuck yuck as this->_ci_scaffolding will exist and try to insert/update
    // it into the database as a column name.
    $this->title   = $_POST['title'];
    $this->content = $_POST['content'];
    $this->date    = time();

    $this->db->update('entries', $this, array('id', $_POST['id']));
}


SO instead of doing the above you can do
Code:
function update_entry()
{
    $data = array(
               'title' => $_POST['title'],
               'content' => $_POST['content'],
             );

    $this->db->where('id', $_POST['id']);
    $this->db->update('entries', $data);
}




Theme © iAndrew 2016 - Forum software by © MyBB