Пытаюсь починить сайт чужой и заодно понять ооп и вдруг натолкнулся на ошибку
no database selected
include_once ('/../../../global.php');
include_once ('config/db.php');
class connections{
var $db_conf = DB1;
function __construct()
{$db_conf = json_decode($this->db_conf);$this->resource=$this->connect($db_conf['host'],$db_conf['username'],$db_conf['password'],$db_conf['database']);}
function connect($host,$lgn,$pwd,$db)
{$resource=mysql_connect($host,$lgn,$pwd);
if(!$resource) die(languages::output_languages('Database_Connection_Error').mysql_error());
mysql_select_db($db) or die(languages::output_languages('Error_selecting_database').mysql_error());
mysql_query('SET NAMES '.$db_conf['encoding'].'');
mysql_query('SET CHARACTER SET ’'.$db_conf['encoding'].'’;');
mysql_query('SET SESSION collation_connection = ’'.$db_conf['encoding'].'’;');
mysql_query ('SET characters_set_client=’'.$db_conf['encoding'].'′');
mysql_query ('SET characters_set_results=’'.$db_conf['encoding'].'′');
mysql_query ('SET collation_connection=’'.$db_conf['encoding'].'’');
return $resource;}
function get_query_simple($query)
{$sql = mysql_query($query) or die(languages::output_languages('request_failed').'<br />'.mysql_error());
return $sql;}
function get_query($query, $result_of_the_query)
{$sql = mysql_query($query) or die(languages::output_languages('request_failed').'<br />'.mysql_error());
while ($row=mysql_fetch_array($sql)){
$result_of_the_query;}}
function get_query_print($query, $result_of_the_query)
{print_r($query);
print_r($result_of_the_query);
die();}
function get_query_total($query)
{$sql = mysql_query($query) or die(languages::output_languages('request_failed').'<br />'.mysql_error());
return mysql_result($sql,0);
}
}
файл config/db.php
<?php
$db1 = array(
'host'=>'localhost',
'username'=>'db_username',
'password'=>'125LOJH',
'database'=>'db_username',
'encoding'=>'utf8_general_ci'
);
$db1 = json_encode($db1);
define ('DB1', $db1);
?>
Не пойму как исправить. Помогите пожалуйста