problème de jointure des tables
bjour,merci pour les conseils et je peux dire que cava bcoup mieux mais j'obtiens toujours des messages d'erreur que voici :
Citation:
Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0xe92c6d HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". in C:\wamp\www\gdt\php.php on line 32
PROJET id-projet nom-projet code-mo resultat-projet montant-projet code-localisation id-nature id-date code-etat
Warning: pg_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\gdt\php.php on line 50
en plus je voudrais injecter un compteur qui permettra d'incrementer les differents identifiants(id-projet,id-nature,id-date,code-localisation,code-mo,code-etat)
merci d'avance et encore merci tes conseils
bne journé M.
problème de jointure des tables
problème de jointure des tables
le message d'erreur que j'obtiens est le suivant:
Citation:
Warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "," LINE 16: WHERE id-nature = 1,id-date =1,code-etat =1,code-localisatio... ^ in C:\wamp\www\gdt\php.php on line 32
PROJET id-projet nom-projet code-mo resultat-projet montant-projet code-localisation id-nature id-date code-etat
Warning: pg_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\gdt\php.php on line 50
voilà le code après les modifications
Code:
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
|
<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,id-date =1,code-etat =1,code-localisation =1,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> |
problème de jointure des tables
non ça passe pas corrrectement c'est pourquoi j'ai envoyé le message d'erreur dans mon message précedent pour que vous m'aidez à corriger ce qui ne va pas dans la partie SELECT et je pense aussi qu'il ya quelque chose qui manque à la partie:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| 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 |
problème de jointure des tables
message reçu et merci de m'avoir consacrer ton temps précieux.
bne journé et portes toi bien