Connecting to a MySQL database with PDO

David Carr

1 min read - 27th Jul, 2013

Table of Contents

This video covers connection to a database using PDO in a try catch block with Exceptions.

The Source Code

<?php

try {

    $db = new PDO('mysql:host=localhost;dbname=temp','root','root');

} catch (Exception $e) {
    echo $e->getMessage();
}
?>

 

0 comments
Add a comment

Copyright © 2024 DC Blog - All rights reserved.