1. Go to this page and download the library: Download websk/php-db 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/ */
use WebSK\DB\DBServiceFactory;
$db_service = DBServiceFactory::factoryMySQL(
$config['settings']['db']['db_skif']
);
use Psr\Container\ContainerInterface;
use WebSK\DB\DBServiceFactory;
$container->set('DB_SERVICE_CONTAINER_ID', function (ContainerInterface $container) {
$db_config = $container->get('settings.db.db_skif');
return DBServiceFactory::factoryMySQL($db_config);
});
use WebSK\DB\DBWrapper;
DBWrapper::setDbService($container->get('DB_SERVICE_CONTAINER_ID'));
$rows = DBWrapper::readAssoc(
'SELECT id, name FROM users WHERE active = ?',
[true]
);