Hi.
I am doing a website and I would like to include a file where it will include php code for connect to mysql server and selecting my mysql database.
So the file is something like (connection.php) :
[code]<?php
$dbhost = ‘db.php-mysql-tutorial.com:3306’;
$dbuser = ‘root’;
$dbpass = ‘password’;
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error connecting to mysql’);
$dbname = ‘petstore’;
mysql_select_db($dbname);
?>[/code]
However, when I include this file into my other pages (e.g. at login.php), it does not connect to the mysql server. I get errors similar to those when the code of connecting to the mysql server is not included.
The include command I use is:
<?php include("connection.php"); ?>
Any ideas what the problem might be?