PHP code example of mtoolkit / mtoolkit-model

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

    

mtoolkit / mtoolkit-model example snippets


// Add a new connection string
MDbConnection::addDbConnection( new \PDO( 'mysql:host=127.0.0.1;dbname=test_db', 'root', 'password' ) );

// Retrieve the database connection
$connection = MDbConnection::getDbConnection();

$query = "SELECT item_01 FROM table_01";
$connection = MDbConnection::getDbConnection();
$sql = new MPDOQuery( $query, $connection );
$sql->bindValue( $key );
$sql->exec();
$result = $sql->getResult();