Page 1 of 1

PHP and MySQL both running, won't connect

Posted: Sat Jan 10, 2004 3:37 pm
by rveliz
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");

?>

Posted: Sun Jan 11, 2004 4:11 am
by bluenote
First question: are PHP and MySQL installed properly?

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.");
?>
and auth.inc like

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