MySQL DB
Product
id name
1 Product #1
2 Product #2
3 Product #3
4 Product #4
Review
id idUser idProduct Rating
1 1 1 A Long Boring Review that is up to 500 characters
2 1 2 A Long Boring Review that is up to 500 characters
3 2 4 A Long Boring Review that is up to 500 characters
4 1 1 A Long Boring Review that is up to 500 characters
What would be the best way of pulling info from both these databases and arranging them as such:
[0] => stdClass Object
(
[id] => 1
[name] => Product #1
[reviews] => Array(
[0]=>
(
[id] => "1"
[idUser] => "1"
[idProduct] => "1"
[Rating] => "A Long Boring Review that is up to 500 characters"
)
[1] = >
(...
)
)
[1] => stdClass Object
(
[id] => 2
[name] => Product #2
[reviews] => Array(
[0]=>
(
[id] => "1"
[idUser] => "1"
[idProduct] => "2"
[Rating] => "A Long Boring Review that is up to 500 characters"
)
[1] = >
(...
)
)
I was thinking about using GROUP_CONCAT but wont that cause a lot of performance issues later on? Also doesn't that have a character limit?