Requete un peu space ....

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Requete un peu space ....

par dogmongo » 23 mars 2007, 15:55

sympa ton site j'aime bien ! droit au but :)

les pages saffiche vraiment très vite j'ai adopter ta technique elle est top !

merci pour l'info

par Ibanez jem » 23 mars 2007, 15:12

Le voici

http://www.chaussminimaxi.com/imp.php

Attention il y a un script d'impression

alors essayer sous IE et sous mozilla

merci ;)

par Invité » 23 mars 2007, 13:24

montre nous le code source généré... :wink:

par Ibanez Jem » 23 mars 2007, 13:18

Bon alors ça marche nickel mais

dans IE ca me fait 3 colones
dans mozilla qu'une seul

Qqun voit pkoi ?

mon script final :
<?php

$req="SELECT * from prod order by nom";
$blup=mysql_query($req);

$i=1;
echo "<table width=\"600\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"3\"> \n";
echo "<tr>";

while ($res = mysql_fetch_array($blup)) { 

echo "<td>";

if($res['taille']=="C"){$taille1=110;$taille2=110;}
if($res['taille']=="L"){$taille1=110;$taille2=73;}
if($res['taille']=="H"){$taille1=110;$taille2=165;}
if($t==0){$t=1;}
  echo "<table><td width='110'><img src='imgref/".$res[image]."' width=$taille1 height=$taille2></td>"; 
  echo "<td><font size=1 face=verdana>Ref ".$res[nom].""; 
  echo "<br>Prix ".$res[prix]."</font></td></table>";
  
  if ($i % 3 == 0) 
  echo "</td>"; 
  $i++; 
  $t=$t+1;
echo "</tr>";


}   
echo "</table> \n";
?>

par dogmongo » 13 mars 2007, 12:06

excellent ca va optimiser ma technique :)

par Ibanez Jem » 13 mars 2007, 11:37

dogmongo voici mon script
<?php

$req="SELECT * from prod order by nom";
$blup=mysql_query($req);

$i=1;
echo "<table width=\"750\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"3\"> \n";
echo "<tr>";

while ($res = mysql_fetch_array($blup)) { 

echo "<td>";

if($res['taille']=="C"){$taille1=110;$taille2=110;}
if($res['taille']=="L"){$taille1=110;$taille2=73;}
if($res['taille']=="H"){$taille1=110;$taille2=165;}
if($t==0){$t=1;}
  echo "<table><td width='110'><img src='imgref/".$res[image]."' width=$taille1 height=$taille2></td>"; 
  echo "<td><font size=1 face=verdana>Ref ".$res[nom].""; 
  echo "<br>Prix ".$res[prix]."</font></td></table>";
  
  if ($i % 3 == 0) 
  echo "</td>"; 
  $i++; 
  $t=$t+1;
echo "</tr>";


}   
echo "</table> \n";
?>

par Ibanez Jem » 13 mars 2007, 11:36

Cool ca marche , et ca marche aussi avec des photos ;)

merci a tous :)

par jojolapine » 13 mars 2007, 10:58

bien sur que c'est posible... ;-)
Ouvre un nouveau sujet, pour nous montrer ce que tu as fait :)
Tout est possible en php :D

par dogmongo » 13 mars 2007, 10:11

si ton système marche au niveau affichage d'image je vais essayer :)

bein non impossible dans le cas d'image avec texte d'accompagnement , mais très bien dans le cas précis :wink:

par raptor » 13 mars 2007, 08:49

Effectivement il faut utiliser l'operateur modulo (%).

Exemple :
$i=1;
while ($res = mysql_fetch_array($req)) {
  echo $res[1];
  if ($i % 3 == 0) echo "<br />";
  $i++;
}
@+

par dogmongo » 12 mars 2007, 21:30

génère un tableau html avec condition sur une boucle !

<?php  

$reqr="select * from matablequellestbien where ok='o' order by stat"; 

$envoi = mysql_query($reqr); 

// début du while
while($tableau = mysql_fetch_array($envoi)) { 

    $Db_stat = $tableau['stat'];

    //mise en tableau
    $result[] .= "$Db_stat";

//fin du while
} 

    //on ouvre le tableau html
    $AFF.= "<table>\n";
    
    //premiere colonne à 0
    $cell=0;
    
    //on démarre la boucle qui génère le tableau
    for($n=0;$n<count($result);$n++) {
         
    $AFF.= ($cell == 0)? "<tr>\n" : "";
    
    $AFF.= ($result[$n]!="")? "<td  valign=\"top\">$result[$n]</td>\n" : "<td>&nbsp;</td>\n";
         
     $cell++;
     
     //on atteind 3 col.. on la remet à 0 et on génère une autre ligne   
     $AFF.= ($cell == 3)? "</tr>\n" : "";
         
     $cell = ($cell == 3)? 0 : $cell;
         		 }
     // c'est fini on ferme le tableau html
     $AFF.= "</table>\n";
?> 
// on affiche le résultat final 
<?=$AFF?>

par jojolapine » 12 mars 2007, 21:11

fait une recherche sur "modulo" dans le forum ....

Requete un peu space ....

par Ibanez Jem » 12 mars 2007, 19:55

Bonjour àtous

Bon alors voila mon prob quand je fais une requette du genre
 <?php 
$reqr="select * from matablequellestbien where ok='o' order by stat";
$envoi = mysql_query($reqr);

// début de la boucle
while($tableau = mysql_fetch_array($envoi)) {
echo ".$tableau['stat'].";

} ?>
Bon la il m'affiche

1
2
3
4
5
6
7
etc ...

Je souhaiterai qu'il me les affiche par 3 genre

123
456
789

sans etre obliger de faire une requete pour chaque ligne genre :

$req="select * from matablequellestbien where ok='o' order by stat desc limit 3";

et apres

$req="select * from matablequellestbien where ok='o' order by stat desc limit 3,3"

$req="select * from matablequellestbien where ok='o' order by stat desc limit 6,3";

Merci d'avance :)