I created a php file that containd the code to connect to my database (mysql_connect and mysql_select_db).
Whne I include the file using the include function in another file it won't work, it says that the access was denied. However when I copy the content of the connect file to the other script file it works.
Here's what I mean if it's not too clear:
db_connect.php:
$db = mysql_connect("localhost", "*****" , "**") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("*****",$db) or die ('I cannot connect to the database because: ' . mysql_error());
news.php:
...
include ("db_connect.php");
...
The above script won't work.
But this script does work:
news.php:
...
$db = mysql_connect("localhost", "*****" , "**") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db("*****",$db) or die ('I cannot connect to the database because: ' . mysql_error());
...
Why??