You’re getting the error because PHP is expecting the $users variable to be an array and it’s not finding an array. Add this line before the line where you fill up $users
$users=array();
That will set up $users as an array, so if it’s empty the foreach will get the array that it expects, even if that array is empty
I’ve added “$users = array();” before the public function like you said, and now I receive this error:
“Parse error: syntax error, unexpected ‘$users’ (T_VARIABLE), expecting function (T_FUNCTION) in C:\Program Files (x86)\Ampps\www\includes\class-query.php on line 107”
I’ve also tried putting it within the public function, but then I still receive the original error.