Codeigniter DB class vs prepared statements Codeigniter DB class vs prepared statements codeigniter codeigniter

Codeigniter DB class vs prepared statements


CI doesn’t support prepared statements, it does support Query Bindings though. Both query bindings and prepared statements prevent sql injection. But I prefers AR because the ease of use. Also it makes the query more readable.

You can check this link for more details.

And check the CI Query Binding from this link


to directly answer the question. yes.

both statements are escaped which provides security from injection attacks.CodeIgniter db insert method does the escaping for you, and a php prepared statement includes escaping by nature.

see this link info on php prepared statements.

otherwise in terms of speed, how they run etc, the two statements are not equivalent.

Hussain has covered the rest.