Bonjour,

Est-ce qu'il y a une manière un peu moins énergivore et plus safe d'écrire cette fonction. Je débute en php donc soyez indulgents...

Merci !!

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
 
	   public function tableau()
        {
 
		$req3 = $this->bdd->query('SELECT * FROM tableau WHERE cat = "1"');
		$i=1;
		$nblignes3 = $req3->rowCount();
		$avtder3 = $nblignes3 - 1;
 
		while ($result3 = $req3->fetchAll())
 
			{
 
			echo "<th class=\"first\" width=\"177\">".$result3[0][1]." </th><br/>";
 
 
				while($i < $avtder3)
				{
				echo "<th>".$result3[$i][1]."</th><br/>";
				$i++;
				}
 
			echo "<th>".$result3[$avtder3][1]."</th>";
			}