PHP / MySQL - How to retrieve 2 separate sets of objects?
Posted
by Dan
on Stack Overflow
See other posts from Stack Overflow
or by Dan
Published on 2010-03-11T09:14:50Z
Indexed on
2010/03/11
20:59 UTC
Read the original article
Hit count: 332
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.
© Stack Overflow or respective owner