Hi,
I am new to PHP and MySQL but i'm running a server and trying to connect some files to a db...i'm using the require() command along with some include files that should log me into my db but it's not working...can someone help???
In my PHP file:
<?php
require("inc/config.inc");
require("inc/auth.inc");
include("inc/header.inc");
?>
PHP and MySQL both running, won't connect
Moderator: General Moderators
First question: are PHP and MySQL installed properly?
Second question: Does the include path in php.ini point to the correct directory - i. e.
?
Third question: What is included?
config.inc like
and auth.inc like
?
If so, auth.inc must be required before config.inc because of password and so on.
Greetings, bluenote
Second question: Does the include path in php.ini point to the correct directory - i. e.
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
include_path= ".:/usr/local/Web/inc"
; or Windows
; Windows: "\path1;\path2"
;include_path = ".;c:\var\www\inc"Third question: What is included?
config.inc like
Code: Select all
<?php
$dbName = "DBstaff";
$userstable = "staff";
MYSQL_CONNECT($hostname,$username,$password) OR DIE("Database connection failed.");
@mysql_select_db("$dbName") or die("Database not found.");
?>Code: Select all
<?php
$hostname = "localhost";
$username = "SomeUser";
$password = "SomePass";
?>If so, auth.inc must be required before config.inc because of password and so on.
Greetings, bluenote