|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/www/FusionChart/Code/PHPClass/Includes/ |
Upload File : |
<?php
// In this page, we open the connection to the Database
// In this page, we open the connection to the Database
// Our MySQL database (blueprintdb) for the Blueprint Application
// Function to connect to the DB
// Now you can pass the database name to the function
function connectToDB( $dbName="" ) {
// These four parameters must be changed dependent on your MySQL settings
$hostdb = 'localhost'; // MySQl host
$userdb = 'root'; // MySQL username
$passdb = ''; // MySQL password
$namedb = $dbName ? $dbName : 'factorydb'; // MySQL database name
$link = mysql_connect ($hostdb, $userdb, $passdb);
if (!$link) {
// we should have connected, but if any of the above parameters
// are incorrect or we can't access the DB for some reason,
// then we will stop execution here
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db($namedb);
if (!$db_selected) {
die ('Can\'t use database : ' . mysql_error());
}
return $link;
}
?>