mysql_fetch_object on complex objects
- by Arsenal
Say for example I have the follwoing DB structure
Table book
id
title
...
Table Author
id
name
...
Table BookAuthor
id
bookid
authorid
And in PHP I have the following object
class Book {
var $id;
var $title;
var $authors = array();
function Book() {}
}
class Author {
var $id;
var $name;
function Author(){}
}
Now, would it be possible using mysql_fetch_object to retrieve the bookobject including the authors as an array of author objects?
If it's possible I'm pretty sure you'll need the basic inner join query
SELECT * FROM tblbook INNER JOIN tblbookauthor on ... (wel you get the point)
Is it possible?
thanks!