groups looks like this '1,2,3,999'
<?php
/**
* int strpos ( string $haystack , mixed $needle [, int $offset = 0 ] )
*/
$dbUser = new PDO('sqlite:'.ROOT.'/var/db/users.db3');
$dbUser->sqliteCreateFunction('strpos', 'strpos', 2);
$sql = 'SELECT username FROM users WHERE strpos(groups,",2,");';
$rows = $dbUser->query($sql)->fetchAll(PDO::FETCH_ASSOC);
print_r($rows);
?>