PHP code example of biaoqianwo / simple-pdo

1. Go to this page and download the library: Download biaoqianwo/simple-pdo 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/ */

    

biaoqianwo / simple-pdo example snippets


return [
    'read' => [
        [
            'host' => '127.0.0.1',
            'port' => 3307,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ],
        [
            'host' => '127.0.0.1',
            'port' => 3308,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ]
    ],
    'write' => [
        [
            'host' => '127.0.0.1',
            'port' => 3306,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ]
    ]
];

$sql = "select * from users where id = ?";
$conditions = [$id];
$result = User::first($sql, $conditions);
var_dump($result);