Bonjour,
J'ai un problème dans mon code php, je souhaiterais afficher un champ de ma table sql mais un message s'affiche "
Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, object given in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\Formation.php on line 30"
Pourriez-vous m'aidez ?
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
49
50
51
52
53
54
55
56 <html> <head> <meta charset="ISO-8859-1"/> <title>FORM@DESK</title> <link href='.css/style.css' type='text/css'> </head> <body> <?php include("Debut.php"); ?> <section> <div style="height: 700px; width: 1000px; overflow: auto; overflow-y: scroll;"></center> <center><?php if (!empty($_SESSION['mail'])) { echo "<p>Voici nos offres, cliquez sur le nom de la formation pour effectuer une réservation</p>"; } else { echo "<p> Pour réserver, créer un compte.</p>"; } $bdd = new PDO('mysql:host=localhost;dbname=nexus;charset=utf8', 'root', ''); $resultatSQL = $bdd->query("Select * FROM formation"); while ($ligne= mysqli_fetch_assoc($resultatSQL)){ echo "<article>"; if (!empty($_SESSION['mail'])) { echo "<a href='Reservation.php".$ligne['NumFor']."'><h2>".$ligne['NomFor']."</h2></a>"; } else { echo "<h2>".$ligne['NomFor']."</h2>"; } echo "<p>".$ligne['DescFor']."</p>"; echo "<p>".$ligne['PrixFor']."</p>"; echo "<p>".$ligne['DateLimiteFor']."</p>"; echo "<img src=\"Images/".$ligne['Images']."\" width=\"300\" height=\"150\" alt=\"images\"/>"; echo "</article>"; } ?></center> </div> </section> <?php include("Fin.php"); ?> </body> </html>
Merci .
Partager