11-26-2010, 08:29 AM
(10-04-2009, 08:51 PM)MyNameIs940 Wrote: Make a settings.inc.php and put this in there:
(CHMOD should be: 755)
PHP Code:<?
$CONFIG['DBHOST'] = "localhost"; // Database servers location, normally localhost
$CONFIG['DBUSER'] = "username"; // sql user
$CONFIG['DBPASS'] = "password"; // db users password
$CONFIG['DBNAME'] = "database"; // Database to connect to
?>
then make database.php
(CHMOD should be: 644)
PHP Code:<?
include("settings.inc.php");
$connection = mysql_connect($CONFIG['DBHOST'],
$CONFIG['DBUSER'],
$CONFIG['DBPASS']) or die("Could not establish a connection with mysql.");
mysql_select_db($CONFIG['DBNAME']) or die("Unable to select database.");
?>
Then in all your codes put:
PHP Code:<? include("database.php"); ?>
You are done
Note: If you need help with CHMOD visit this link: http://www.supportforums.net/showthread.php?tid=182
You can also just use the define function:
PHP Code:
define("host", "HOSTHERE");
define("username", "USERNAMEHERE");
define("pass", "PASSWORDHERE");
define("db", "DATABASENAME");