View sourcecode

The following files exists in this folder. Click to view.

index.php

1 lines ASCII Unix (LF)
1
<?php


$en4fil['database']['dsn']         = 'mysql:host=localhost;dbname=Movie;';
$en4fil['database']['username']     = 'webserver';
$en4fil['database']['password']     = 'letmepass';
$en4fil['database']['driver_options']     = array(PDO:: MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'");


class CDatabase
{
      public function __construct($options= []) {
                
        $default = array(
          'dsn' => null,
          'username' => null,
          'password' => null,
          'driver_options' => null,
          'fetch_style' => PDO::FETCH_OBJ,
        );
        echo "<pre>";
        var_dump($default);
        var_dump($options);
        echo "</pre>";

        $this->$options = array_merge([], []);
        $this->$options = array_merge($default, $options);
      }
}


$db = new CDatabase($en4fil['database']);