Bonjour,ce que je veux c'est exploiter ,ensemble les differentes tables de ma base pour afficher toutes les informations rélatives à chaque projet ou du moins un bon sous-ensemble,pour cela j'ai fais la jointures de ma table principale "projet" avec les autres tables(localisation,mo,nature,date,etat) qui sont liées à la table projet par des identifiants(clefs étrangères dans la table projet). je voudrais que vous m'aider à corriger ce que ne va pas dans mon code et j'obtiens le message d'erreur suivant : parse error in C:\wamp\www\gdt\php.php on line 33 ,ça concerne la ligne "where"et je pense qu'il ya d'autres incorrections dans la partie select,je me demande aussi si l'on doit pas changer quelque chose dans la partie "while" voici le code entier:
merci d'avance.vos contributions seront les bienvenues
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <title> gestion de projet </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <?php $conn =("host=localhost port=5432 dbname= gdt user=postgres password=gabero"); $dbconn = pg_connect("$conn"); // connexion à une base de données nommée "gdt" sur l'hôte "localhost" avec un // nom d'utilisateur"postgres" et un mot de passe"gabero" // éxecution de la requète SQL $sql = pg_query("SELECT projet.id-projet,projet.nom-projet,projet.id-date,projet.id-nature, projet.code-localisation,projet.code-etat,projet.code-mo,projet.resultat-projet,projet.montant-projet, localisation.libelle,mo.libelle,nature.libelle,date.debut-date,etat.libelle FROM projet INNER JOIN date ON projet.id-date = date.id-date INNER JOIN etat ON projet.code-etat = etat.code-etat INNER JOIN nature ON projet.id-nature = nature.id-nature INNER JOIN mo ON projet.code-mo = mo.code-mo INNER JOIN localistion ON projet.code-localisation = localisation.code-localisation ") where id-nature = 1 AND id-date =1 AND code-etat =1 AND code-localisation =1 AND code-mo =1 ; ?> <!-- En-tete du tableau --> <table border="1"> <caption><strong> PROJET</strong></caption> <tr> <td>id-projet</td> <td>nom-projet</td> <td>code-mo</td> <td>resultat-projet</td> <td>montant-projet</td> <td>code-localisation</td> <td>id-nature</td> <td>id-date</td> <td>code-etat</td> </tr> <?php // utilisation de la boucle tant que while($infos = pg_fetch_array($sql)) { // affichage des resultats echo"<tr>";//ligne du tableau echo "<td>".$infos['id-projet']."</td>"; echo "<td>".$infos['nom-projet']."</td>"; echo "<td>".$infos['code-mo']."</td>"; echo "<td>".$infos['resultat-projet']."</td>"; echo "<td>".$infos['montant-projet']."</td>"; echo "<td>".$infos['code-localisation']."</td>"; echo "<td>".$infos['id-nature']."</td>"; echo "<td>".$infos['id-date']."</td>"; echo "<td>".$infos['code-etat']."</td>"; echo"</tr>"; //fermeture de la ligne } //fermeture du tant que ?> </table> <!--fermeture du tableau--> <?php pg_close($dbconn); ?> </body> </html>
Partager