Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $hostname = 'localhost';
- $username = 'root';
- $password = '';
- function testdb_connect ($hostname, $username, $password){
- $dbh= new PDO("mysql:host=$hostname;dbname=users", $username, $password);
- return $dbh;
- }
- try {
- $dbh = testdb_connect ($hostname, $username, $password);
- echo 'Connected to database';
- } catch(PDOException $e) {
- echo $e->getMessage();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement