I have a query SELECT id, title, imagename FROM cat JOIN images ON id=id
I want to echo only once title per category and then 3 images. And then the same with next category.
Tables layout:
Cat Table
id title
Images Table
id imagename
The final result should look like this:
Title
Imagename Imagename Imagename
Title
Imagename Imagename Imagename
The query is printed using foreach cycle as object ($this->results as $result ) { echo $result->title; }
etc..
Also I'm interested if there are other ways (queries?) of getting the same results.