Tables liées

Fermé
logoni Messages postés 19 Date d'inscription lundi 20 juillet 2009 Statut Membre Dernière intervention 27 septembre 2009 - 25 août 2009 à 15:29
moderno31 Messages postés 870 Date d'inscription mardi 23 juin 2009 Statut Membre Dernière intervention 8 août 2012 - 25 août 2009 à 17:27
Bonjour,je voudrais que vous m'aidez à corriger ce qui ne vas pas dans mon code.merci d'avance le code est le suivant:
<!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 projet.\"id-nature\" = 1
AND projet.\"id-date\" = 1
AND projet.\"code-etat\"=1
AND projet.\"code-localisation\" = 1
AND projet.\"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>

1 réponse

moderno31 Messages postés 870 Date d'inscription mardi 23 juin 2009 Statut Membre Dernière intervention 8 août 2012 92
25 août 2009 à 17:27
Ce qui ne va pas ? un bien grand mot ?
Quel est ton problème précisémment ?
Et autre question, la requete telle qu'elle est rédigée, fonctionne ?
La syntaxe me surprends quelque pêeu
0