Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: putuguna
- * Date: 7/18/2016
- * Time: 8:06 AM
- */
- class ConnectionDB {
- function getConnection(){
- $host = "localhost";
- $username = "root";
- $password = "";
- try{
- $conn = new PDO("mysql:host=$host;dbname=testlogin", $username, $password);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- return $conn;
- }catch (PDOException $e){
- echo "ERROR : " .$e->getMessage();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement