// $theme est le thème choisi aléatoirement
$sql = "SELECT id, contenu FROM mesQuestions WHERE theme=$theme";
$req = mysql_query($sql); <?php
$reponse = $bdd->query("SELECT themex.theme, theme_tintin.Question, theme_tintin.Rep1, theme_tintin.Repjuste, theme_tintin.Rep3 FROM themex, theme_tintin WHERE theme_tintin.id_themex = themex.id");
while($donnees = $reponse->fetch()) {
echo $donnees['Question'];
}
?>
J'ai mis là chaques question l'id_theme correspondant et résultat quelque soit le theme choisis toutes les questions de tous les themes s'affichent sa ne filtre pas !
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', 'root');
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
?>
<?php
$theme = htmlspecialchars($_GET['theme']);
$reponse = $bdd->query('SELECT theme.themes, theme.id, questions.Question FROM theme, questions WHERE themes.id = ' . $theme . ' AND questions.id_theme = themes.id');
$donnees = $reponse->fetch();
?>
<div id = "quest"> <?php echo $donnees['Question']; ?> </div>
Résultat: rien ne s'affiche quelque soit le theme choisi !
montre ce que t'as faisMerci mais sa ne change absolument rien... je comprend vraiment pas ce qui peut foirer là...
$donnees = $reponse->fetch();
var_dump($donnees);
ta bien les erreur php d'activé avec le niveau au maximum ? <?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', 'root');
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
?>
<?php
$themex = htmlspecialchars($_GET['theme']);
$id = htmlspecialchars($_GET['id']);
$reponse = $bdd->query('SELECT themex.theme, themex.id, theme_tintin.Question FROM themex, theme_tintin WHERE theme_tintin.id_themex = themex.id AND themex.id = '. $themex. '');
while($donnees = $reponse->fetch()){
var_dump($donnees);
?>
<div id = "quest"> <?php echo $donnees['Question']; ?> </div>
<?php
}
?>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', 'root');
$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
?>
<?php
$theme = htmlspecialchars($_GET['theme']);
$id = htmlspecialchars($_GET['id']);
$reponse = $bdd->query('SELECT themes.theme, themes.id, questions.Question FROM themes, questions WHERE questions.id_themes = themes.id AND themes.id = '. $theme. '');
while($donnees = $reponse->fetch()){
var_dump($donnees);
?>
<div id = "quest"> <?php echo $donnees['Question']; ?> </div>
<?php
}
?>