Problem with require.
Posted: Thu Jun 14, 2012 1:03 pm
So I can't for the life of me figure out what is wrong in this particular script.
I am getting this error
Connect.php
the required php file: app_config.php
I am getting this error
They are both in the scripts folder. But just doesn't wanna work not really sure why.Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'DATABASE_HOST' (1) in /home/content/91/9347091/html/utbgaming/scripts/connect.php on line 6
Error connecting to database_name: Unknown MySQL server host 'DATABASE_HOST' (1)
Connect.php
Code: Select all
<?php
require 'app_config.php';
mysql_connect("DATABASE_HOST",
"DATABASE_USERNAME", "DATABASE_PASSWORD")
or die("<p>Error connecting to database_name: ".mysql_error() . "</p>");
echo "<p>Connected to MySQL!</p>";
mysql_select_db("DATABASE_NAME")
or die ("<p>Error selecting the database DATABASE_NAME: ".
mysql_error(). "<p>");
echo "<p>Connect to MySQL, using database DATABASE_NAME.</p>";
?>Code: Select all
<?php
define("DATABASE_HOST", "newsis.db.9347091.hostedresource.com");
define("DATABASE_USERNAME", "newsis");
define("DATABASE_PASSWORD", "lollol3");
define("DATABASE_NAME", "newsis");
?>