I have a question about for loops and Active Record and querying.
I have this code below that uses id stored in session and it is used to query for the users’ first names.
Problem:
The first half of the code is working, where it is able to get the first name and populate $usernames.
But the second half of the code, in the For Loop, $thisuser does not become an object, and i get the error of "Trying to get property of non-object".
I know that $session[‘user’.$j] works, and that the for loop works if i put in $session[‘user1’] instead. I’ve even tried re-initializing $thisuser in each loop, but there is no difference.
What am I missing?
I understand that putting it all into an array would be better than having 5 variables, but this might become a problem when i make the switch later on.