【问题标题】:Why this happen? How can i solve it?为什么会这样?我该如何解决?
【发布时间】:2016-05-02 15:01:17
【问题描述】:

严重性:8192

消息:mysql_connect():mysql 扩展已弃用,将来将被删除:改用 mysqli 或 PDO

文件名:mysql/mysql_driver.php

行号:136

回溯:

文件:C:\wamp\www\ci\application\controllers\c_testing.php 线路:27 函数:__构造

文件:C:\wamp\www\ci\index.php 线路:315 函数:require_once

在我的 databease.php 中的 codeigniter 文件中,我使用了这个

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost:81',
    'username' => 'root',
    'password' => '1234',
    'database' => 'testing',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

然后在我的 testing.php 文件中

Class Testingdata extends CI_Model{
    function __construct(){
        parent::__construct();
        $this->load->database();
        $this->db->reconnect();
    }

    // data obtained from database 
    function get_data(){
        $this->db->select('*');
        $this->db->from('lecturer_profile');



        $query = $this->db->get();
        return $query->result();
    } 
}

?>`enter code here`

【问题讨论】:

标签: codeigniter ionic-framework


【解决方案1】:

您需要更改数据库配置。转到项目中的以下路径/application/config/database.php 找到dbdriver 设置并确保它是mysqli

【讨论】:

    猜你喜欢
    • 2021-11-02
    • 1970-01-01
    • 1970-01-01
    • 2010-12-16
    • 2017-06-19
    • 2021-07-01
    • 2011-02-13
    • 2012-12-03
    相关资源
    最近更新 更多