PHP code example of romeoz / rock-db

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

    

romeoz / rock-db example snippets


$rows = (new \rock\db\Query())
    ->select('id, name')
    ->from('users')
    ->limit(10)
    ->all();

// find
$users = Users::find()
    ->where(['status' => Users::STATUS_ACTIVE])
    ->orderBy('id')
    ->all();
    
// insert
$users = new Users();
$users ->name = 'Tom';
$users ->save();