How to execute a prepared statement in CI |
Hi all, I have been unable to find documentation on this. In MySQL, I have the following prepared statement:
Code: SET @sql = NULL; This allows me to dynamically retrieve "contact types" associated with a contact. How can I execute this statement in CI and retrieve the results? I have tried the following and receive a SQL syntax error upon execution: Code: $this->db->query("PREPARE statement FROM @sql; EXECUTE statement; DEALLOCATE PREPARE statement;"); Thanks for any help you can give!
CI doesn't support prepared statements. You can use bindings vor replacement like described on the bottom of page "Query Bindings":
https://ellislab.com/codeigniter/user-gu...eries.html For safe querys you should use the active record class: https://ellislab.com/codeigniter/user-gu...ecord.html |
Welcome Guest, Not a member yet? Register Sign In |