PHPサイトを作ろうとしているのですが、インクルードファイルでインクルード変数が使えない問題があります!
index.php
<?php
require 'core/init.php';
?>
init.php
<?php
require 'config.php';
require 'db/connect.php';
?>
config.php
<?php
// Config
// The Title of the site
$site_title = 'php-site';
$site_desc = 'A awesome PHP site!';
$site_keywords = 'php, html5, css3, awesome';
$site_author = 'erty5000';
// Database - MySQL
// MySQL host
$db_host = 'localhost';
// MySQL username
$db_username = 'myuser';
// MySQL password
$db_password = 'mypassword';
// MySQL database
$db_database = 'mydb';
// Error to display at the top of the page if a connection problem occured
$db_connect_error = 'Sorry, we\'re experiencing connection problems.';
?>
connect.php
<?php
mysql_connect($db_host, $db_username, $db_password) or die($db_connection_error);
mysql_select_db($db_database) or die($db_connection_error);
?>
私が得るエラーは
Notice: Undefined variable: db_host in C:\xampp\htdocs\w\php-site\core\db\connect.php on line 2
Notice: Undefined variable: db_username in C:\xampp\htdocs\w\php-site\core\db\connect.php on line 2
Notice: Undefined variable: db_password in C:\xampp\htdocs\w\php-site\core\db\connect.php on line 2
Warning: mysql_connect(): Access denied for user ''@'localhost' (using password: NO) in C:\xampp\htdocs\w\php-site\core\db\connect.php on line 2
Notice: Undefined variable: db_connection_error in C:\xampp\htdocs\w\php-site\core\db\connect.php on line 2
とても長い投稿で申し訳ありませんが、誰かが私を助けてくれることを本当に願っています!