Bonjour,

je souhaiterais faire un array d'un array... le code d'origine lorsque je fait un print_r de mon $rows est:

"Array
(
[0] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => Alimentation 128Mo
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[1] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => boitier
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[2] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => Carte mère type 1
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[3] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => pack vis
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[4] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => CD lancement
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[5] => Array
(
[commande_id] => 1
[pack_id] => 2
[libelle] => Alim 512Mo
[etat] => 2
[SAV] => 0
[produit_a_renvoyer] => 0
[actif] => 1
)

[6] => Array
(
[commande_id] => 1
[pack_id] => 2
[libelle] => Boitier
[etat] => 2
[SAV] => 0
[produit_a_renvoyer] => 0
[actif] => 1
)

[7] => Array
(
[commande_id] => 1
[pack_id] => 2
[libelle] => pack vis
[etat] => 2
[SAV] => 0
[produit_a_renvoyer] => 0
[actif] => 1
)
[8] => Array
(
[commande_id] => 1
[pack_id] => 2
[libelle] => CD lancement
[etat] => 3
[SAV] => 0
[produit_a_renvoyer] => 0
[actif] => 1
)
)
"
Hors je souhaiterais :
Array
(
[1] => Array
(
[1] => Array
(
[0] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => Alim 128Mo
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[1] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => boitier
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[2] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => carte mère Type 1
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[3] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => pack vis
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

[4] => Array
(
[commande_id] => 1
[pack_id] => 1
[libelle] => CD lancement
[etat] => 2
[SAV] => 1
[produit_a_renvoyer] => 1
[actif] => 0
)

)
[2] => Array
(
[0] => Array
(
[commande_id] => 1
[pack_id] => 2
[libelle] => Alim 512Mo
[etat] => 2
[SAV] => 0
[produit_a_renvoyer] => 0
[actif] => 1
)

[1] => Array
(
[commande_id] => 1
[pack_id] => 2
[libelle] => Boitier
[etat] => 2
[SAV] => 0
[produit_a_renvoyer] => 0
[actif] => 1
)

[2] => Array
(
[commande_id] => 1
[pack_id] => 2
[libelle] => pack vis
[etat] => 2
[SAV] => 0
[produit_a_renvoyer] => 0
[actif] => 1
)

[3] => Array
(
[commande_id] => 1
[pack_id] => 2
[libelle] => CD lancement
[etat] => 3
[SAV] => 0
[produit_a_renvoyer] => 0
[actif] => 1
)
)

)

)
j'ai essayé le code suivant :

$pack = array($row['commande_id'] => array($row['pack_id'] =>
$rows));
fonction renvoyant le fameux $rows :
function ListeproduitsDansPack(){

$query = "SELECT commande_id, commande.pack_id, libelle, etat, SAV, produit_a_renvoyer,actif
FROM sav, pack, commande
WHERE pack.stock_id = sav.stock_id
AND pack.pack_id = commande.pack_id
AND pack.pack_id IS NOT NULL
AND commande.commande_id = '1'
ORDER BY sav.stock_id";
$stmt = PdoSql::getInstance()->prepare($query);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $rows;
}
Je tourne en rond depuis 2 jours, je n'arrive pas à faire en sorte que mon $row['pack_id'] soit l'index du second array

je vous remercie par avance pour l'aide apportée.