PHP code example of bzync / nextsql

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

    

bzync / nextsql example snippets



n = NextSQL\Client::connect([
    'address'  => 'db.example.com:7210',
    'database' => 'production',
    'user'     => 'app',
    'password' => getenv('NEXTSQL_DATABASE_PASS'),
    'tls'      => ['cafile' => '/etc/nextsql/ca.pem', 'servername' => 'db.example.com'],
]);

$res = $conn->exec('SELECT id, name FROM users WHERE id = $1', [1]);
foreach ($res['rows'] as $row) {
    print_r($row);
}
$conn->close();