Imran Qamer
Imran Qamer

Reputation: 2263

How to prevent automatically escaping in $this->db->update query in Codeigniter

Update function in Codeigniter automatically escapes my query.

My question is how can we prevent it?

As we can do same in select function with second parameter like $this->db->select('col1,col2', FALSE);

EDIT: I have found this $this->db->set('field', 'field+1', FALSE); but in this situation is I want to use an array instead of single parameter like $this->db->set($array); Again how to prevent escaping in this array situation?

Upvotes: 0

Views: 788

Answers (1)

Imran Qamer
Imran Qamer

Reputation: 2263

I structured one solution, though its not a full version but it may help for other users.

In my case I wanted to escape just one column's value so I put that column in set function and all other array in update function like

$this->db->set("col1","value1",FALSE);
$this->db->update("tablenme",$allotherdataarray,$wherearray);

It worked for me.

Upvotes: 2

Related Questions