Bonjour,
je voudrait avoir un peu d'aide..
je doit afficher un tableau d'une structure JSON
mais je n'arrive pas a construire mon tableau
voici le json :
je voudrait construire mon tableau et l'envoyer a ma vue de template twig..
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 array (size=3) 0 => array (size=3) 0 => array (size=2) 'idauteur' => array (size=3) 'idauteur' => int 1 'nomauteur' => string 'Dupond' (length=6) 'prenomauteur' => string 'Pierre' (length=6) 'idlivre' => array (size=3) 'idlivre' => int 1 'titre' => string 'Php avances' (length=11) 'idlangue' => array (size=2) 'idlangue' => int 1 'libelle' => string 'Francais' (length=8) 1 => array (size=2) 'idauteur' => array (size=3) 'idauteur' => int 2 'nomauteur' => string 'SaintPierre' (length=11) 'prenomauteur' => string 'Lisa' (length=4) 'idlivre' => array (size=3) 'idlivre' => int 1 'titre' => string 'Php avances' (length=11) 'idlangue' => array (size=2) 'idlangue' => int 1 'libelle' => string 'Francais' (length=8) 2 => array (size=2) 'idauteur' => array (size=3) 'idauteur' => int 2 'nomauteur' => string 'SaintPierre' (length=11) 'prenomauteur' => string 'Lisa' (length=4) 'idlivre' => array (size=3) 'idlivre' => int 2 'titre' => string 'Java avances' (length=12) 'idlangue' => array (size=2) 'idlangue' => int 1 'libelle' => string 'Francais' (length=8)
voici mon code qui plante:
merci d'avance pour votre aide..
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 for($i=0;$i<count($array[0]);$i++) { $tabAuteur['tabAuteur'][$array[0][$i]['idauteur']] = array('idauteur' => $array[0][$i]['idauteur'], 'nomauteur' => $array[0][$i]['nomauteur'], ); }
Partager