Php msql aléatoire
francois59510
Messages postés
18
Date d'inscription
Statut
Membre
Dernière intervention
-
francois59510 Messages postés 18 Date d'inscription Statut Membre Dernière intervention -
francois59510 Messages postés 18 Date d'inscription Statut Membre Dernière intervention -
Bonjour, je viens de commencé le php, mais j'ai un problème je veux faire un qcm sur du voc mais il faut que dans mon tableau il y est qu'une donnée sur deux soit la traduction anglais soit Français et j' arrive pas!HELP ME!
voici mon script :
<div id="corp">
<?php include('connexion.inc'); ?>
<?php
$reponse= $bdd->query('SELECT * FROM voc_anglais_oliver');
?>
<table>
<tr>
<td><strong>Anglais:</strong></td>
<td><strong>Français:</strong></td>
</tr>
</table>
<?php
while ($donnees = $reponse->fetch())
{
?>
<table>
<tr>
<td> <?php echo $donnees['anglais']; ?></td>
<td><?php echo $donnees['francais']; ?></td>
</tr>
</table>
<?php
}
$reponse->closeCursor();
?>
</div>
Merci!
voici mon script :
<div id="corp">
<?php include('connexion.inc'); ?>
<?php
$reponse= $bdd->query('SELECT * FROM voc_anglais_oliver');
?>
<table>
<tr>
<td><strong>Anglais:</strong></td>
<td><strong>Français:</strong></td>
</tr>
</table>
<?php
while ($donnees = $reponse->fetch())
{
?>
<table>
<tr>
<td> <?php echo $donnees['anglais']; ?></td>
<td><?php echo $donnees['francais']; ?></td>
</tr>
</table>
<?php
}
$reponse->closeCursor();
?>
</div>
Merci!
A voir également:
- Php msql aléatoire
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Php alert ✓ - Forum PHP
- Tirage au sort excel aléatoire sans doublon ✓ - Forum Excel
- Vlc lecture aléatoire - Forum Téléphones & tablettes Android
1 réponse
Bonjour,
Tu peux utiliser une fonction aléatoire :
Xavier
Tu peux utiliser une fonction aléatoire :
<div id="corp"> <?php include('connexion.inc'); ?> <?php $reponse= $bdd->query('SELECT * FROM voc_anglais_oliver'); ?> <table> <tr> <td><strong>Anglais:</strong></td> <td><strong>Français:</strong></td> </tr> </table> <?php while ($donnees = $reponse->fetch()) { $anglais = (mt_rand(0, 1) == 0); ?> <table> <tr> <td><?php echo ($anglais) ? $donnees['anglais'] : ''; ?></td> <td><?php echo ($anglais) ? '' : $donnees['francais']; ?></td> </tr> </table> <?php } $reponse->closeCursor(); ?> </div>
Xavier
francois59510
Messages postés
18
Date d'inscription
Statut
Membre
Dernière intervention
Merci!