j'essaie d'utiliser foreach pour parcourir un tableau mais je n'arrive pas a trouver la bonne syntaxe,
pourriez-vous m'aider s.v.p?
voici le tableau
excusez-moi pour l'indentation mais le texte s'est déplacer et je n'arrive pas a le replacer ici
et le foreach
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 <?php while($info = mysql_fetch_array($data)) { $tableau_res[] = array('date_depart' =>htmlspecialchars($info['date_depart']), 'heure_depart' =>htmlspecialchars($info['heure_depart']), 'places_disponibles' => htmlspecialchars($info['places_disponibles']), 'province_depart' => htmlspecialchars($info['province_depart']), 'ville_depart' => htmlspecialchars($info['ville_depart']), 'point_depart'=>htmlspecialchars($info['point_depart']), 'province_destination'=> htmlspecialchars($info['province_destination']), 'ville_destination' => htmlspecialchars($info['ville_destination']), 'point_destination' => htmlspecialchars($info['point_destination']), 'prix' => htmlspecialchars($info['prix'])); }
c'est ici qu'il ya probleme
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 foreach($tableau_res-> as $key=>$info){ echo'<tr><td>'<strong>.$info['date_depart'].</strong><br />.$info['heure_depart'].'</td>'; echo'<td>'<strong>.$info['ville_depart'].</strong><br />.$info['point_depart'].'</td>'; echo'<td>'<strong>.$info['ville_destination'].</strong><br />.$info['point_destination'].'</td>'; echo'<td>'<strong>.$info['places_disponibles'].</strong>'</td>'; echo'<td>'.$info['prix'].</strong>'</td>'; '<td>' '</td>'; '</tr>'; }
Partager