I have a database with a one to many relationship and i was wondering what was the best way to parse the resultset.
this post explains exactly what my situation:
http://stackoverflow.com/questions/5...o-many-results
I don't have PDO neither MySQLi
So if you go to the post, you'll see that there are 2 solutions.
the first solves the problem in MySQL with Concat()
and the second solves it in PHP. it puts if() conditions in a while() loop.
I would finally like an array like this:
Expand|Select|Wrap|Line Numbers
- $elements = array(
- 0=>array(
- 'url_id'=>'id_1',
- 'categories'=> array(
- 0=>'category1',
- 1=>'category2'
- )
- )
- 1=>array(
- 'url_id'=>'id_2',
- 'categories'=> array(
- 0=>'category1',
- 1=>'category2'
- )
- )
- ...
- )
but i woudn't have to put conditions in my while() loop.
What do you think would be faster?
If you have any experience doing it,
please let me know it would save my some time in testing
Thank you very much
Regards