Bonsoir à tous,

Voila j'ai des données provenant de ma base de donnée sous cette forme:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
array (size=3)
  0 => 
    object(Order_model)[27]
      public 'firstname' => string 'Deeptha' (length=7)
      public 'lastname' => string 'Wickrema' (length=8)
      public 'id_customer' => string '2' (length=1)
      public 'id_order' => string '3' (length=1)
      public 'date_add' => string '2013-12-08 05:10:26' (length=19)
      public 'product_name' => string 'iPod shuffle - Couleur : Vert' (length=29)
  1 => 
    object(Order_model)[26]
      public 'firstname' => string 'Deeptha' (length=7)
      public 'lastname' => string 'Wickrema' (length=8)
      public 'id_customer' => string '2' (length=1)
      public 'id_order' => string '2' (length=1)
      public 'date_add' => string '2013-12-08 05:09:39' (length=19)
      public 'product_name' => string 'iPod Nano - Capacité : 16Go, Couleur : Noir' (length=44)
  2 => 
    object(Order_model)[28]
      public 'firstname' => string 'Deeptha' (length=7)
      public 'lastname' => string 'Wickrema' (length=8)
      public 'id_customer' => string '2' (length=1)
      public 'id_order' => string '2' (length=1)
      public 'date_add' => string '2013-12-08 05:09:39' (length=19)
      public 'product_name' => string 'iPod touch - Capacité : 8Go' (length=28)
Comme vous pouvez le constatez parfois il se peut que le client commande plusieurs produits appartenant a la même commande, c'est pour cela que le id_order = 2 apparaît deux fois de suite.

Ce que je souhaiterai c'est recréer une représentation des données sous cette forme:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
0 => 
    object(Order_model)[27]
      public 'firstname' => string 'Deeptha' (length=7)
      public 'lastname' => string 'Wickrema' (length=8)
      public 'id_customer' => string '2' (length=1)
      public 'id_order' => string '3' (length=1)
      public 'date_add' => string '2013-12-08 05:10:26' (length=19)
      public 'product_name' => string 'iPod shuffle - Couleur : Vert' (length=29)


  1 => 
    object(Order_model)[26]
      public 'firstname' => string 'Deeptha' (length=7)
      public 'lastname' => string 'Wickrema' (length=8)
      public 'id_customer' => string '2' (length=1)
      public 'id_order' => string '2' (length=1)
      public 'date_add' => string '2013-12-08 05:09:39' (length=19)
      public 'product_name' => string 'iPod Nano - Capacité : 16Go, Couleur : Noir' (length=44)
      public 'product_name' => string 'iPod touch - Capacité : 8Go' (length=28)
Je voudrais simplement ajouter chaque nom de produit de nouveau produit portant le même id_order.