Page 1 sur 1

Probleme MYSQL

Posté : 30 mars 2013, 19:55
par cyprianus
Bonjour, Je ne comprendds pas pourquoi le code affiche q'uen image différentes des autres?
<center><h1>Winer coins</h1></center>
<?php include "config.php" ;?>
<style>
div{
  display:inline-block;
  vertical-align:top;
}
</style>
<div style="height:1000px;width:1200px;"> <?php
 
 
$i=0;
$a=1;
$ra= mysql_query("SELECT numero FROM carre WHERE color=1");


while($i<100) {
while ($r = mysql_fetch_array($ra)) {
if($a != $r['numero']){
 ?><a href="http://ctertrais.free.fr/buy.php?id=<?php echo $a;?>"><div id="<?php echo $a;?>"style="margin-bottom:10px;width: 72px; height:72px; background: url('img/carrevide.png');"><?php echo $a;?></div></a> <?php
  }
  else{
  ?><a href="http://ctertrais.free.fr/buy.php?id=<?php echo $a;?>"><div id="<?php echo $a;?>"style="margin-bottom:10px;width: 72px; height:72px; background: url('img/carreplein.png');"><?php echo $a;?></div></a><?php
  }
  $i=$i+1;
  $a=$a+1;
  }}

?></div>

Re: Probleme MYSQL

Posté : 30 mars 2013, 20:55
par moogli
salut,


c'est quoi le but de ce code ? afficher 100 fois la même chose ?

a la fin du 1er tour de 1er while le jeux de résultat de la requête est épuisé tu ne passera donc plus dans le second sur les 99 autres tours....



@+

Re: Probleme MYSQL

Posté : 30 mars 2013, 21:03
par cyprianus
Afficher 100 fois la meme chose oui mais aussi changé d'images lorsque le numero de celle ci est dans la basse de données

Re: Probleme MYSQL

Posté : 31 mars 2013, 08:21
par cyprianus
aidez moi svp :D

Re: Probleme MYSQL

Posté : 31 mars 2013, 10:34
par cyprianus
ctertrais.free.fr pour vous montrer
<center><h1>Winer coins</h1></center>
<?php include "config.php" ;?>
<style>
div{
  display:inline-block;
  vertical-align:top;
}
</style>
<div style="height:1000px;width:1200px;"> <?php
  
  
$i=0;
$a=1;
while($i<100) {
$ra= mysql_query("SELECT numero FROM carre WHERE color=1");
while($r = mysql_fetch_array( $ra )){
if($a != $r['numero']){
 ?><a href="http://ctertrais.free.fr/buy.php?id=<?php echo $a;?>"><div id="<?php echo $a;?>"style="margin-bottom:10px;width: 72px; height:72px; background: url('img/carrevide.png');"><?php echo $a;?></div></a> <?php
  }
  else{
  ?><a href="http://ctertrais.free.fr/buy.php?id=<?php echo $a;?>"><div id="<?php echo $a;?>"style="margin-bottom:10px;width: 72px; height:72px; background: url('img/carreplein.png');"><?php echo $a;?></div></a><?php
  }}
  $i=$i+1;
  $a=$a+1;
}
?></div>

Re: Probleme MYSQL

Posté : 31 mars 2013, 10:36
par cyprianus
salut enfait sur ce lien regarde http://ctertrais.free.fr les carrés s'affiche normalement mais en plusieurs fois ce que je cherche c'est a comprendre pourquoi ils s'affcihent plusieurs fois.Je viens de remarquer qu'il s'affiche autant de fois qu'il y a de numéros de casse dans ma requête mysql. Comment faire pour que chaque numéros s'affiche une seule fois?