So I have a page, let's call it page1.php that is requiring another page (page2.php) which also requires another page (page3.php). Now page3.php just contains four variables which are the database server's address, username, password, and database to select.
Page2.php simply contains functions that interact with the server based on page3.php's variables. Here is a sample of that code.
$conn = new PDO("mysql:host=$pdo_conn;dbname=$pdo_database", $pdo_username, $pdo_password);
Whenever I run the script, this fatal error occurs...
Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user ''@'10.24.3.40'
So the hostname is inserted but the username and password isn't. When I manually change the variables to the actual string containing the username and password, it works completely fine. Why is this happening?