PHP code example of archangeldesign / archangeldb2

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

    

archangeldesign / archangeldb2 example snippets


curl -sS https://getcomposer.org/installer | php

php composer.phar update


// initialized with config file adbConfig.php in module or project root
=> 0, 'active' => 1]);
// $users now holds associative array of users

$adb->deleteRecords('users', ['deleted' => 1]);
// all users with column deleted set to 1 will be deleted from table

$adb->insert('user', ['name' => 'Archangel', 'surname' => 'Design', 'deleted' => 0]);
// user has been inserted to table users

$adb->updateRecords('user',
[
    'name' ='Archangel', 
    'surname' = 'System', 
    'deleted' => 1
], 'name');
// record with name = 'Archangel' has been updated (or multiple records)

$idList = $adb->fetchList('users', 'id', ['deleted' => 1]);
// returns comma separated list of id as string ( like "1,2,3,4,5")
// for IN statements