Getting Started
Installation
Install the library using composer
composer require codesvault/howdy-qb
Database connection
It connects to the WordPress database automatically.
$db = new DB();
But if you need then you also can set connection manually.
$db = DB::setConnection([
"dbhost" => 'mysql_host',
"dbname" => 'database_name',
"dbuser" => 'database_user',
"dbpassword" => 'database_password',
"prefix" => 'database_table_prefix'
]);
$db::select('posts.post_title')
->from('posts posts')
->get();
Debugging
To display query results in terminal, you should connect to the database using setConnection
method.
// debug.php
$db = DB::setConnection();
$result =
$db::select('posts.post_title')
->from('posts posts')
->get();
print_r($result);
// terminal: php debug.php