0

I am new to php and I am working on a website that was build in 2012 and am trying to run the already written code. I imported the database to my local phpmyadmin and after making sure that the database connection is working, I am still getting a require_once failed to open stream warning and the site does not work. I was hoping someone could give me an idea how to fix the problem. The program does not run after the second line of code below in my kernel.php file.

require_once("framework/config.php");
require_once(CORE_PATH."DB.php");
require_once(CORE_PATH."template.php");
require_once(CORE_PATH."users.php");

The DB.php file looks as follows with some additional code below:

function DBConnect() 
{
    // if connection exists
    if ( isset($this->DB) )
        return $this->DB;

    //made result
    $result = @mysql_connect($this->dbHost, $this->dbUser, $this->dbPass);
    // trow error if there is one
    if ( !$result )
        $this->trowCommon("DBConncect", $this->lang);
    if (!@mysql_select_db($this->dbName))
        $this->trowCommon("DBSelect", $this->lang);
    // set link to DB connection
    $this->DB = $result;
    //set charset
    $this->DBsetCharset();

    return $this->DB;
}

function DBConnecti()
{
    if ( isset($this->DB) )
        return $this->DB;
    $result = new mysqli($this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
        if ( mysqli_connect_error() )
        $this->trowCommon("DBConncect", $this->lang);
  $this->DB = $result;


    return $this->DB;
}
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
  • Did you set `CORE_PATH`? – rndus2r Sep 29 '17 at 16:08
  • Yes, it is done it as follows in config.php which is outside the core folder: define('CORE_PATH', FRAMEWORK_PATH."core/"); – Donika Pavlova Sep 29 '17 at 16:12
  • And you are sure that your path does exist? Just print it. – rndus2r Sep 29 '17 at 16:16
  • Do not mix mysql_* and mysqli API's. Also don't use mysql_* .its deprecated. Either use mysqli or pdo – Rotimi Sep 29 '17 at 16:17
  • I am sure it exists as I am looking at the project structure, but I am not familiar enough with php and don't know how to print it, or where to look for it. All the code above was already written by a different developer and I just need to make some changes to it, so I am not familiar with why he used what he used. – Donika Pavlova Sep 29 '17 at 16:22

0 Answers0