Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- include files...
February 15, 2008, 8:23 pm
rate this thread
I include it in a number of .PHP files (at the top of the file) with the
line -- include ('dbConnect.php');
I also close the connection at the bottom of the file.
For some reason it doesn't seem to connect. I try to SELECT items from
the database, but it doesn't return anything. However, if I just
cut-and-paste the contents of the file into the top of the page, it
works fine. Am I doing something wrong?
$hostname = "localhost";
$dbuser = "root";
$dbpassword = "myPass";
$dbname = "cert";
$con = mysql_connect("$hostname","$dbuser","$dbpassword");
die('Could not connect: ' . mysql_error());
Re: include files...
Start with something simple in your include file such as:
echo "Include file works.";
Then at least you will know your file is getting call at all.
Then you can ascertain if the code is incorrect.
When you call the file exclude the ().