How to execute mysql? $sql=DB::select('..'); (for plunig)

Hello,
who could help me?
how I can to execute mysql?

use DB;

$sql = DB::select('select t.id as id, p.name as name FROM tasks t, projects p WHERE … );

Fatal error: Uncaught Error: Class ‘DB’ not found in…

or with mysqli
thanks in advance

You need to use PicoDB as Kanboard does not use mysqli.

The following can be used in any class that extends ‘Kanboard\Core\Base’
Example:

$this->db->table(TaskModel::TABLE)
->columns(‘SUM(time_estimated) AS time_estimated’, ‘SUM(time_spent) AS time_spent’, ‘is_active’)
->eq(‘project_id’, $project_id)
->groupBy(‘is_active’)
->findAll();

1 Like