CodeIgniter Forums

Full Version: Insert Query Bindings are not being filled in
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
Can you show us your full code example even the array data.