Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

conect_from_db_datalayer

//first run this code in terminal
/** composer require coffeecode/datalayer */

//conect db using datalayer 
define("DATA_LAYER_CONFIG", [
    "driver" => "mysql",
    "host" => "localhost",
    "port" => "3306",
    "dbname" => "datalayer_example",
    "username" => "root",
    "passwd" => "",
    "options" => [
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
        PDO::ATTR_CASE => PDO::CASE_NATURAL
    ]
]);
Source by packagist.org #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
2+8 =