PHP:
prepare(\"SELECT * FROM `users`\");
$stmt->execute();
$result = $stmt->get_result();
//
I will reference this question since this is what you need: checking if a number is divisible by 6 PHP
Your logic you should basically be: If a number is divisible by 6 then do something otherwise do something else.
if ($row_number % 6 == 0) {
// Row number is 6, 12, 18 and so on
} else {
// Other rows
}