Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(!ConnectionManager::getDataSource('default'))
- {
- die(); //this will be a message instead
- }
- <?php
- $filePresent = true;
- if (!file_exists(CONFIGS.'database.php')):
- echo '<span class="notice-failure">Database configuration file is not present. Please contact admin@website</span>';
- $filePresent = false;
- endif;
- if ($filePresent!=false):
- uses('model' . DS . 'connection_manager');
- $db = ConnectionManager::getInstance();
- @$connected = $db->getDataSource('default');
- if (!$connected->isConnected()):
- echo '<p><span class="notice-failure">Not able to connect to the database. Please contact admin@website</span></p>';
- endif;
- endif;
- ?>
- $servername = "localhost";
- $username = "username";
- $password = "password";
- // Create connection
- $conn = new mysqli($servername, $username, $password);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- echo "Connected successfully";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement