Welcome Guest, Not a member yet? Register   Sign In
Insert Query Bindings are not being filled in
#1

Hello guys. I'm using Code Igniter 2.0 and I'm trying to create an insert statement using query bindings, but it gives me this error message when executing the query:

"Field 'table.field' cannot be a zero-length string"


My query looks a little something like this:

insert into [table] (Field1, Field2) values (?, ?)

The statement I'm running to execute this insert looks like this:

$this->db->query("
insert into [table] (Field1, Field2) values (?, ?)", [array of values])


The error message shows me that blank values are inserted for the parameters above, even though the array has values inside. So the insert statement comes out as:
insert into [table] (Field1, Field2) values ('', '')


Doesn't seem like there's something wrong with my query. Why is it inserting blanks even though I'm passing it a properly initialized array?
Reply
#2

Can you show us your full code example even the array data.

Reply




Theme © iAndrew 2016 - Forum software by © MyBB