PHP code example of cleantalk / btree_database

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

    

cleantalk / btree_database example snippets




use Cleantalk\Common\BtreeDatabase\FileDB;

//__DIR__ . '/data';

// Example array contains networks
$data = array(
    'network'     => '2130706433',
    'mask'        => '4294967295',
    'status'      => 1,
    'is_personal' => 0,
);


try {
    // Instantiate the DB main controller
    $file_db = new FileDB('fw_nets', $db_location);

    // Prepare and insert data using fluid interface
    $insert = $file_db->prepareData(array($data))->insert();

    // Perform request using fluid interface
    $db_results = $file_db
        ->setWhere( array( 'network' => array('2130706433'), ) )
        ->setLimit( 0, 20 )
        ->select( 'network', 'mask', 'status', 'is_personal' );
        
    //Use ->delete to delete database
    //$file_db->delete();
} catch (\Exception $e) {
    print $e->getMessage();
}

var_dump($db_results);