PHP code example of davidfricker / dataabstracter

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

    

davidfricker / dataabstracter example snippets


use DavidFricker\DataAbstracter\Adapter\MySQLDatabaseWrapper ;

$MySQLDatabaseWrapper = new MySQLDatabaseWrapper($dsn, $username, $password);

$where = ['col_name' => 'expected_value'];
$limit = 10;
$MySQLDatabaseWrapper->delete('table_name', $where, $limit);

$data = ['col_name' => 'new_value'];
$where = ['col_name' => 'expected_value'];
$limit = 10;
$MySQLDatabaseWrapper->update('table_name', $data, $where, $limit);

$columns = ['col_name_1', 'col_name_2'];
$where = ['col_name' => 'expected_value'];
$limit = 10;
$MySQLDatabaseWrapper->fetch('table_name', $columns, $where, $limit);

$data = ['col_name_1' => 'new_value', 'col_name_2' => 'new_value'];
$MySQLDatabaseWrapper->insert('table_name', $data);

$new_record = ['col_name_1' => 'new_value', 'col_name_2' => 'new_value'];
$MySQLDatabaseWrapper->insert('table_name', $new_record);

$new_record = ['col_name_1' => 'new_value', 'col_name_2' => 'new_value'];
$MySQLDatabaseWrapper->insert('table_name', $new_record);