How to use MySQLi Driver in Codeigniter

前端 未结 4 930
醉梦人生
醉梦人生 2020-12-17 23:29

Hi I\'m kinda new to this and I would like to ask someone here that are experts in codeigniter framework and PHP.

How can I use mysqli drivers in php native query? F

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-18 00:15

    Once you have specified 'mysqli', you can use the following function to get mysqli. For example, mysqli_real_escape_str, etc.:

    function get_mysqli() { 
        $db = (array)get_instance()->db;
        return mysqli_connect('localhost', $db['username'], $db['password'], $db['database']);
    }
    

提交回复
热议问题