PHP / MySQL - How to retrieve 2 separate sets of objects?
- by Dan
Hi,
I have a set of models which correspond to tables in my database. I have been retrieving them easily enough, for example.
$result = $mysqli->query('SOME SQL');
$post = $result->fetch_object;
What would be the best approach for performing a join and also returning the related objects?
For example, each post is created by a user, so for each row returned in the joined statement, both a page and user object should be returned.
Any advice appreciated.
Thanks.