PHP code example of openlss / lib-db

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

    

openlss / lib-db example snippets


//connect
Db::_get()->setConfig($dbconfig)->connect();

//execute a fetch
$result = Db::_get()->fetch('SELECT * FROM `table` WHERE `col` = ?',array($col));

$config = array(
	 'driver'		=>	'mysql'
	,'database'		=>	'database_name'
	,'host'			=>	'server_host'
	,'port'			=>	'server_port'
	,'user'			=>	'username'
	,'password'		=>	'password'
);