PHP code example of reymark / database

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

    

reymark / database example snippets




$dbConfig = [
  'host'     => 'localhost',
  'username' => 'your_db_user',
  'password' => 'your_db_pass',
  'database' => 'your_db_name',
];

$db = new \phpdb\Database($dbConfig);

// Simple SELECT
$rows = $db->query("SELECT * FROM users WHERE active = 1");

// Insert
$insertId = $db->insert('users', [
  'name'  => 'John Doe',
  'email' => '[email protected]'
]);

// Update
$affected = $db->update('users', ['active' => 0], "id = {$insertId}");

// Delete
$deleted = $db->delete('users', "id = {$insertId}");