1

I want to install php script, and I give this error:

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\includes\global.php:29 Stack trace: #0 C:\xampp\htdocs\includes\global.php(107): db_connection() #1 C:\xampp\htdocs\index.php(8): include_once('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\includes\global.php on line 29

in C:\xampp\htdocs\includes\global.php I have:

//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);
    }

an in config.php I have:

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

any solution?

John Conde
  • 212,985
  • 98
  • 444
  • 485
James Raul
  • 21
  • 2

0 Answers0