PHP code example of arjunkomath / crud

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

    

arjunkomath / crud example snippets



ORM::configure('mysql:host=localhost;dbname=my_database');
ORM::configure('username', 'database_user');
ORM::configure('password', 'top_secret');

$this->crud = new CRUD\CRUD();

$result = $this->crud->read('table_name');

$result = $this->crud->read('table_name','id');

$result = $this->crud->save('table_name', array ("column1" => "value1", "column2" => "value2"));

$result = $this->crud->save('table_name', array ("column1" => "value1", "column2" => "value2"), 'id');

$result = $this->crud->delete('table_name', 'id');

$result = $this->crud->find('table_name', 'field_name', 'value');

$this->crud = new CRUD\Admin();

$this->crud->table('table_name');

$this->crud->table('table_name', array ('field_name'));

$this->crud->table('table_name', 'id');

$this->crud->table('table_name', 'id', array ('field_name'));

$this->crud->create('table_name');

$this->crud->create('table_name', array ('field_name'));

$this->crud->update('table_name', 'id');

$this->crud->create('table_name', 'id', array ('field_name'));