Welcome Guest, Not a member yet? Register   Sign In
active record error
#1

[eluser]NachoF[/eluser]
Hey guys, Im getting a weird error when I try to insert an entry... my model has as variables the same three fields as my table... so I then just to
Code:
$this->db->insert('requerimientos', $this);
and the error Im getting is
Quote:A Database Error Occurred

Error Number: 1054

Unknown column '_ci_ob_level' in 'field list'

INSERT INTO `requerimientos` (`id_Session`, `id_Repuesto`, `id_Modulo`, `_ci_ob_level`, `_ci_view_path`, `_ci_is_php5`, `_ci_is_instance`) VALUES ('e6ec12c93a2044306077a3ec80b38937', '1', '1', 1, '/var/www/html/jolman/system/application/views/', 0, 0)

any ideas??... Im trying to modify my app so that it works with php4 and Im running into a lot of problems.... I already tried calling my webhost provider and they said they cant change to php5////btw Im using the latest CI but php 4.4
#2

[eluser]Tim Reynolds[/eluser]
Should you not be passing the insert an array like so,

$data = array(
'title' => 'My title' ,
'name' => 'My Name' ,
'date' => 'My date'
);

$this->db->insert('mytable', $data);

The array defines the column header and the data.

Tim
#3

[eluser]NachoF[/eluser]
But $this is an object.... you can also pass an object... I have done it like that for a long time now... its just that it worked locally but not on the webhost..
Its exactly as it is on the user guide for models.
http://ellislab.com/codeigniter/user-gui....html#what
#4

[eluser]Tim Reynolds[/eluser]
I have only ever passed an Array and personally cannot see the use of using individual variables. But each to there own.

Have you checked your live db to double check the column headers match. The error seems to have an issue with,

Unknown column ‘_ci_ob_level’ in ‘field list’
#5

[eluser]NachoF[/eluser]
Im not trying to be stubborn its just that its frustating that Im following exactly what the user guide says and it works just fine on my localhost but not on the webhost that doesnt support php 5 which has me running to meet my deadline.... if I start changing everything to an array isntead of the $this object Im gonna take forever.
#6

[eluser]Thorpe Obazee[/eluser]
You might get your answer here. I can tell that it won't be helpful to you though.

http://ellislab.com/forums/viewthread/75640/

[quote author="Derek Jones" date="1242101820"]$this is not just your model class, but the CI super object.[/quote]
#7

[eluser]NachoF[/eluser]
haha, yes, he was replying that to me... I ended up doing as you sugested... putting my data into an array... thanks.




Theme © iAndrew 2016 - Forum software by © MyBB