202

Answer

Solution:

The question you are asking is more about the request than the result array. Can you edit your post to specify the request you have ?

In SQL, there is a "GROUP BY" parameter in order to make groups.

Select * From Table GROUP BY `sessions_title`
155

Answer

Solution:

You can alter your sql query and use the GROUP BY clause

Or possibly php array_values

<?php
    print_r(array_values($result));
?>
547

Answer

Solution:

The following code helped me group the arrays

if($objects)
        {
            $grouped = array();
            foreach($objects as $object) {
                if(!array_key_exists($object->id, $grouped)) {
                    $newObject = new stdClass();
                    $newObject->id = $object->id;
                    $newObject->title = $object->title;
                    $newObject->contents = $object->contents;
                    $newObject->follow_up_link = $object->follow_up_link;
                    $newObject->created_at = $object->created_at;
                    $newObject->ITEMS = array();
                    $grouped[$object->id] = $newObject;
                }
                $taskObject = new stdClass();
                $taskObject->news_id = $object->news_id;
                $taskObject->extension = $object->extension;
                $taskObject->resource_link = $object->resource_link ;
                $grouped[$object->id]->ITEMS[] = $taskObject;
            }

    $grouped = array_values($grouped);  

People are also looking for solutions to the problem: php - Event listener not dispatched while testing

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.