[eluser]UnknownPlayer[/eluser]
Hi, i need help with array, this is my array structure:
Code:
Array
(
[0] => Array
(
[id] => 1
[thread_id] => 1
[body] => text text text
[priority] => 2
[sender_id] => 1
[cdate] => 2012-07-27 17:01:28
[status] => 1
[subject] => subj
[username] => up
)
[1] => Array
(
[id] => 31
[thread_id] => 1
[body] => 213
[priority] => 2
[sender_id] => 26
[cdate] => 2012-07-27 19:46:39
[status] => 0
[subject] => subj
[username] => up
)
[2] => Array
(
[id] => 32
[thread_id] => 1
[body] => 213
[priority] => 2
[sender_id] => 26
[cdate] => 2012-07-27 19:46:40
[status] => 0
[subject] => subj
[username] => up
)
[3] => Array
(
[id] => 33
[thread_id] => 2
[body] => 213
[priority] => 2
[sender_id] => 26
[cdate] => 2012-07-27 19:46:41
[status] => 0
[subject] => subj
[username] => up
)
[4] => Array
(
[id] => 34
[thread_id] => 2
[body] => 213
[priority] => 2
[sender_id] => 26
[cdate] => 2012-07-27 19:46:41
[status] => 0
[subject] => subj
[username] => up
)
there is my controller:
Code:
public function all() {
$user_id = '1';
$msgs = $this->Msg_model->get_all_threads($user_id);
foreach ($msgs as $msg) {
// need code here
}
}
now i need to array be grouped by threads, in thread_id = 1 to be in array set all messages that belog to that thread(in this case first and second), and on thread_id = 2 to be third and fourth, can someone help me ?