summaryrefslogtreecommitdiff
path: root/includes/model/UserGroups_model.php
blob: 769871e944adf1f77732c64f88a975e30e44c9be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

use Engelsystem\Database\DB;

/**
 * Returns users groups
 *
 * @param int $userId
 * @return array[]
 */
function User_groups($userId)
{
    return DB::select('
          SELECT `Groups`.*
          FROM `UserGroups`
          JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
          WHERE `UserGroups`.`uid`=?
          ORDER BY `UserGroups`.`group_id`
       ',
        [$userId]
    );
}