Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In File requiring the connect:
- function connect($state,$db)
- {
- if($state='open') {include ('scripts/script_connect.php?db='.$db);} elseif ($state='close') { mysql_close();}
- }
- In the Connect File:
- $database_server = "localhost";
- $database_user = "root";
- $database_password = "";
- $database_name = $_GET['db'];
- $connection = mysql_connect($database_server, $database_user, $database_password);
- if (!$connection)
- {
- die('Connnection could not be established due to the following error: ' . mysql_error());
- }
- mysql_select_db($database_name, $connection) or die('The database could not be selected due to the following error:' . mysql_error());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement