Welcome Guest, Not a member yet? Register   Sign In
Unknown column
#1

[eluser]umefarooq[/eluser]
Hi
im posting data from form to model after getting all post it give me this error.Unknown column '_module'
here is my code
Code:
$this->db->insert('flipp_settings',$this);
#2

[eluser]GSV Sleeper Service[/eluser]
take a look at the active record insert example. - http://ellislab.com/codeigniter/user-gui...mples.html
the second parameter to db->insert should be an associative array of values. you are passing $this as the second parameter, and $this refers to the CI superobject.
#3

[eluser]umefarooq[/eluser]
ya you are right but here in this exmaple you can see what is the difference. because im following the same way in following example.

Model
#4

[eluser]GSV Sleeper Service[/eluser]
hmmm, that's a very confusing example. what else does $this contain?
#5

[eluser]wiredesignz[/eluser]
$this = the model object, and the db driver will try to use every class variable of the model object to build it's insert SQL, as per the example you show.

Unless your table has a _module column I recommend that you change the way you are using insert because your model object appears to have class variables that are not in your table.
#6

[eluser]Colin Williams[/eluser]
I don't think Models should be used to represent objects, as you are doing in this context. I mean, you certainly can do it, but you need to consider the constraints and caveats of doing this.




Theme © iAndrew 2016 - Forum software by © MyBB