PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc show notice when null is passed as an argument
1) The GROUP BY statement must include all fields in the SELECT not being aggregated or constant cols. 2) There was a missing space causing problems to databases using named parameters.