i've got 3 tables:
+-----------------+ | validations | +----+-------+----+ | id | param | ... +----+-------+
+------------------+ | replacements | +----+-------------+ | id | replacement | +----+-------------+
+--------------------------------+ | validations-replacements | +---------------+----------------+ | validation_id | replacement_id | +---------------+----------------+
Now I'm running my SQL query on that tables (with joins of course). And what I receive in PHP is sth. like that:
... [6] => stdClass Object ( [id] => 11 [search_param] => Dänische Belletristik [replacement] => Denmark ) [7] => stdClass Object ( [id] => 11 [search_param] => Dänische Belletristik [replacement] => Fiction ) ...
Now, in my PHP-Array I've got the same 'search_param' and 'id' multiple times. That sucks for printing it to screen. I could group the data by 'id' to avoid that, but then I've only got 1 'replacement' value available.
What I'm looking for would be an result like this:
... [7] => stdClass Object ( [id] => 11 [search_param] => Dänische Belletristik [replacement] => array(Denmark, Fiction) ) ...
What I want to know: Is that possible with my table structure by just fixing the query? Or do I have to care about that in my PHP-Code - if so: any hints how to do it best? There's plenty of data... Is my table structure correct? I'm still a bit uncertain when it comes to databases...
Best regards.