Assez compliquer - affichage resulat table différent par rapport à une autre tab

Résolu
cs_angelx Messages postés 18 Date d'inscription jeudi 19 août 2004 Statut Membre Dernière intervention 2 décembre 2005 - 9 nov. 2005 à 09:38
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 - 9 nov. 2005 à 14:47
Bonjour a tous,



j'ai besoin de votre aide



voici mon probleme



table 1



champs1 champs2 champ3

blabla azer 3

blabla2 azer2 1



table 2

id fr en

1 aaaa bbbb

2 cccc dddd

3 eeee ffffff



voila maintenant

j'aimerais que ca affiche selon une variable "fr" ou "en" qui correspond a la table 2



si la variable x est en "fr"



blabla azer eeee

blabla2 azer2 aaaa



et si la variable x est en "en"



blabla azer ffffff


blabla2 azer2 bbbb





voila j'espère avoir été claire



merci d'avance a toit les personnes qui peuvent m'aider

4 réponses

malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
9 nov. 2005 à 14:47
Heu oui ben ta requête est foireuse là. C'est quoi ces quotes inversés sur le nom des champs...?

mots_bil.id

par exemple.



Ensuite il te manque une variable $id pour savoir à quoi tu fais référence.
3
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
9 nov. 2005 à 09:56
Hello,

'SELECT
tbl1.champs1, tbl1.champs2, tbl2.'.$x.'
FROM
table1 AS tbl1, table2 AS tbl2
WHERE
(tbl1.id = tbl2.id) AND
(tbl1.id = '.$id.')'
0
malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
9 nov. 2005 à 09:58
ah t'as pas mis de id dans tbl1...bon ben (tbl2.id='.$id.') alors, ou tbl1.champs3='.$id.'
...enfin t'as compris.
0
cs_angelx Messages postés 18 Date d'inscription jeudi 19 août 2004 Statut Membre Dernière intervention 2 décembre 2005
9 nov. 2005 à 14:07
je ne sais pas mais ca fonctionne pas il y a rien qui s'affiche



voila mon code



<?php

$x=fr;

mysql_select_db($database_raal, $raal);

$query_testdb = "SELECT joueurs.id, joueurs.nom, joueurs.prenom,
joueurs.position, mots_bil.$x FROM joueurs,mots_bil WHERE
joueurs.`position` = mots_bil.`id`";

$testdb = mysql_query($query_testdb, $raal) or die(mysql_error());

$row_testdb = mysql_fetch_assoc($testdb);

$totalRows_testdb = mysql_num_rows($testdb);

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<title>Document sans titre</title>

</head>





id,

nom,

prenom,

position,

<?php echo $x; ?>,

----

<?php echo $row_testdb['id']; ?>,

<?php echo $row_testdb['nom']; ?>,

<?php echo $row_testdb['prenom']; ?>,

<?php echo $row_testdb['position']; ?>,

<?php echo $row_testdb['$x']; ?>




</html>

<?php

mysql_free_result($testdb);

?>
0
Rejoignez-nous