can anyone please tell me about this <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = '1234'; $dbname = 'sessions'; mysql_connect($dbhost, $dbuser, $dbpass) or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); ?> what should i put in my conf so that i can just call it using include . what else should i put on it? response is needed badly. im just playing with script today and preparing for my senior project hopefully next year.
You include that file using include('conf.php'); in the script that needs it. You don't actually need to do anything to that file unless your username, password and/or database name are incorrect
Pu the below codes in a file named db.php <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = '1234'; $dbname = 'sessions'; mysql_connect($dbhost, $dbuser, $dbpass) or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); ?> Code (markup): I guess your conf.php contains several settings. Now in your conf.php you can simply call this using the following line: include('db.php'); If you have other fuctions on conf.php based on database, you should include the db.php on top portion.