PHP code example of nafisc / mysqli-wrapper

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

    

nafisc / mysqli-wrapper example snippets


    use \MySqliWrapper\Database as DB;

    DB::register(
        [
            'name'     => 'main', 
            'host'     => 'localhost',
            'username' => 'root',
            'password' => 'password',
            'database' => 'database',
            'port'     => 3306,
            'charset'  => 'utf8',
        ]
    );

    $user = DB::get('main')
            ->table('users')
            ->where('name', '=', 'Nathan')
            ->first();

    $user->age = 10;
    $user->save();