Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Connection{
- function getConnection(){
- $host = "localhost";
- $username = "root";
- $password = "";
- $dbname = "pagination";
- try{
- $conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- return $conn;
- }catch(PDOException $ex){
- echo "Error koneksi ke database : " . $ex.getMessage();
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment