PHP code example of daydiff / simple-db

1. Go to this page and download the library: Download daydiff/simple-db library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

daydiff / simple-db example snippets

 php
use Daydiff\SimpleDb\Db;

$dsn = 'mysql:dbname=great_company;host=localhost';
$user = 'database_user';
$password = 'database_password';

$db = new Db($dsn, $user, $password);
$name = $db->scalar('SELECT name FROM user WHERE id = :id', [':id' => 1]);