Welcome Guest, Not a member yet? Register   Sign In
QueryBuild appends undeclared column names, need to reset qb_set
#1

Today I came across a strange phenomena with Query Builder.

Whenever I use $this->db->insert($array_to_insert), it appends two undeclared table names to the query causing it to fail.

I found the culprit when I used var_dump(db) and found the two inside the array qb_set:

["qb_set":protected]=> array(2) { ["`col_1`"]=> string(2) "''" ["`col_2`"]=> string(2) "''" }

How do you guys recommend resetting this array properly? I swear I do not use col_1 and col_2 nowhere near where I perform insertions.
Reply
#2

Make a var_dump to $array_to_insert.
Reply
#3

(09-25-2016, 01:58 AM)Paradinight Wrote: Make a var_dump to $array_to_insert.

I tried that and the two columns were not in the result.
Reply
#4

(This post was last modified: 09-25-2016, 04:56 AM by InsiteFX. Edit Reason: typo error )

Show your code for inserting the array.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

You can't use $this->db->insert($array_to_insert) like that.
$this->db->insert() expects 2 parameters. The first one is the table name, the second one is an array with field names and values for that table.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB