How can I call manually a PHP database function on CodeIgniter's database handler object? How to retrieve the connection ($dbc
), or call a function like mysql_real_escape_string($dbc, $variable)
?
You can call any mysql native function and access mysql connection id.
See CodeIgniter User Guide
$this->db->conn_id
will get you the current connection link object if you are in a CI context. It will return a mysqli or mysql link object that you can pass into functions like mysql_real_escape_string
or the updated mysqli, which actually requires the link object. Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With