1. Go to this page and download the library: Download natilosir/orm 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/ */
natilosir / orm example snippets
use natilosir\orm\db;
$users = DB::Table('users')
->where('name', 'second')
->where('email', 'third')
->orderBy('id', 'max') // max = DESC, min = ASC
// ->orderBy('max') // default value is id
->limit(3)
->get();
$updateData = [
'user' => 'Jane.Doe',
'name' => 'John Smith',
'email' => '[email protected]'];
DB::Table('users')
->update(1, $updateData); // 1 is the ID and update({where}, {UpdateArray})
// Alternatively, update with multiple conditions:
DB::Table('users')
->update(['name' => 1, 'user' => 3], $updateData); // update({whereArray}, {UpdateArray})
//AND
DB::Table('users')
// ->where(['name' => 1, 'user' => 2])
->where('name', 1) //AND oder methods in where
->update($updateData);
$data = DB::Table('users');
$data->user = 'first';
$data->name = 'second';
$data->email = 'third';
$data->save(1); // 1 is the ID for the record to update $data->save('name' => 'Jane Doe');
DB::Table('users')
->delete(1); // 1 is the ID of the record to delete
// Alternatively, delete using conditions:
DB::Table('users')
->delete(['name' => 1, 'user' => 6]);
//AND
DB::Table('users')
->where(['name' => 1, 'user' => 5]) //AND oder methods in where
->delete();