i.e : i have 2 tables
- Product (
id,name) - Photo (
id,name,photo_id)
And I need to get result in array like this:
array(
'id' => 1,
'name' => product,
'photos' => array(
array('id' => 1, 'name' => 'photo1')
array('id' => 2, 'name' => 'photo2')
)
}
Is it possible in PHP using clear SQL?
I know that is possible to get 2 arrays and connect it but I have many records and I dont want to wase time to quering.
2 Photo ( id, name, photo_id )just use product_id_fk instead of photo_id and your are done.