I'm using php + sql. Now I've a table like this:
user_id word
-------------
u1 w1
u1 w2
u2 w1
u2 w3
And I want to query the database for the data grouped by user. The desired result should be a hierarchical array, like
array("u1"=>array("0"=>"w1', "1"=>"w2"), "u2"=>array("0"=>"w1", "1"=>"w3"))
How can I do that?
Edit
I have only wrote some ordinary sql's like
select * from DB order by user
And I'm afraid it's nothing close.