Can't connect to MySQL with "require_once"
Posted: Sun Oct 30, 2005 6:30 am
Jcart | Please use
The mysql_connect.php file is quite simple:
If I put the code from the mysql_connect.php DIRECTLY into the index.php file, it works fine. when I try to call it seperately with the require_once command, I get no results.
I'm in a HUGE time crunch on this, so any help would be appreciated.
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I'm trying to build a simple auction site and I cannot connect to my database using the require_once command. This is how I have the command:Code: Select all
require_once ('mysql_connect.php');Code: Select all
<?php
// This file contains the database access information. This file also establishes a connection to MySQL and selects the database.
// Set the database access information as constants.
DEFINE ('DB_USER', 'userid');
DEFINE ('DB_PASSWORD', 'pwd');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'dbname');
// Make the connnection and then select the database.
$dbc = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db (DB_NAME);
?>I'm in a HUGE time crunch on this, so any help would be appreciated.
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]