PHP code example of elzekool / fluent_dbal

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

    

elzekool / fluent_dbal example snippets



$pdo = new \PDO('mysql:host=127.0.0.1;dbname=world', '', '');

$dbal = new FluentDbal($pdo);

$query = $dbal
    ->newQuery()
    ->select('city.Name,country.name, city.District')
    ->from('city')
    ->leftJoin('country', 'country.Code = city.CountryCode')
    ->where('city.CountryCode = ?', 'NLD')        
        
    // Orderby can be repeated
    ->orderby('city.Population','DESC')
    ->orderby('city.Name','ASC')
        
    ->limit(1);
    
$city = $query->execute();

print_r($city->fetch());
// stdClass Object
// (
//    [Name] => Amsterdam
//    [name] => Netherlands
//    [District] => Noord-Holland
// )