致命错误:未捕获错误:在C中调用未定义函数mysql_connect()

时间:2017-10-11 11:49:36

标签: php undefined mysql-connect

我想安装php脚本,我给出了这个错误:

  

致命错误:未捕获错误:在C:\ xampp \ htdocs \ includes \ global.php中调用未定义函数mysql_connect():29堆栈跟踪:#0 C:\ xampp \ htdocs \ includes \ global.php(107 ):db_connection()#1 C:\ xampp \ htdocs \ index.php(8):include_once(' C:\ xampp \ htdocs ...')#2 {main}抛出C:第29行\ xampp \ htdocs \ includes \ global.php

在C:\ xampp \ htdocs \ includes \ global.php我有:

//Begin Function
    function db_connection()
    {
        global $config,$data_sql;
        $data_sql = mysql_connect($config["sql_host"], $config["sql_user"], $config["sql_pass"]);
        if (!$data_sql) die("Can't connect to MySql");
        mysql_select_db($config["db_name"],$data_sql) or die("Can't select database");
    }
    function db_close()
    {
        global $data_sql;
        @mysql_close($data_sql);
    }

在config.php中我有:

<?php
    $config["sql_host"] = "localhost";
    $config["sql_user"] = "root";
    $config["sql_pass"] = "";
    $config["db_name"] = "sql123";
?>

任何解决方案?

0 个答案:

没有答案