PHP Classes

File: fwphp/01mater/shop/ch24_guitar_shop/model/database.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/01mater/shop/ch24_guitar_shop/model/database.php  >  Download  
File: fwphp/01mater/shop/ch24_guitar_shop/model/database.php
Role: Example script
Content type: text/plain
Description: Example script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 2 months ago
Size: 406 bytes
 

Contents

Class file image Download
<?php
// Set up the database connection
$dsn = 'mysql:host=localhost;dbname=z_shop'; // my_guitar_shop2
$username = 'mgs_user';
$password = 'pa55word';
$options = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);

try {
   
$db = new PDO($dsn, $username, $password, $options);
} catch (
PDOException $e) {
   
$error_message = $e->getMessage();
    include(
'errors/db_error_connect.php');
    exit();
}
?>

For more information send a message to info at phpclasses dot org.