CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

if, j'ny arrive pas !

News jeu

Expeditions: Samurai veut révolutionner le RPG tactique avec une aventure entièrement jouable en coop

Voir
kemedu77
kemedu77
Niveau 7
23 mars 2004 à 19:07:36

Bonjour, quelq´un pourrai me dire comment faire pour intégré un if...else dans ce code:

while($row = mysql_fetch_array($result)) {
echo ´<tr>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´id´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´liste´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´nom´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´prenom´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´adresse´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´code_p´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´ville´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´date_n´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´h´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´f´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´msa´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´rg´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´ca´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´fp´].´</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">Ici, il me faut un if</font></td>´;
echo ´</tr>´."\n";
}
echo ´</table>´."\n";
}

electron_libre
electron_libre
Niveau 10
23 mars 2004 à 19:43:19

while($row = mysql_fetch_array($result)){
if( condition){
$toto = le traitement;
} / / fin if

echo ´<tr>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$row[´id´].´</font></td>´;
. ..
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">´.$toto.´</font></td>´; / /ici tu affiches le resultat de ton if plus haut
echo ´</tr>´."\n";
}
echo ´</table>´."\n";

bon sans plus explication c pas facil de t´aider

kemedu77
kemedu77
Niveau 7
24 mars 2004 à 11:47:48

OK, j´vais testé et si je n´y arrive pas j´essayerai de mieu m´expliqué !

kemedu77
kemedu77
Niveau 7
24 mars 2004 à 13:37:40

En fait, c´est simple:
j´ai ma table comme ca:

CREATE TABLE membre (
id int(11) NOT NULL default ´´,
. ..
sexe varchar(255) NOT NULL default ´´,
. ..
PRIMARY KEY ( id)
) TYPE=MyISAM;

Je veux mettre le resultat: si sexe=f ( femme ! ) alors dans la case qui correspond a masculin, il y a rien et celle feminin, il y a X.

mon script:

if($total) {
/ / debut du tableau
echo ´<table bgcolor="#FFFFFF" width="100%">´."\n";
echo ´<TR>´;
. ..
echo ´<TD WIDTH="10" bgcolor="#669999" VALIGN="TOP" COLSPAN=2><font size="1"><b>Sexe</b></font></TD>´;
. ..
echo ´</TR>´;
echo ´<TR>´;
. ..
echo ´</TR>´."\n";
while($row = mysql_fetch_array($result)) {
echo ´<tr>´;
. ..
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">ici le resultat homme ( rien si sexe=f)</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">ici le resultat femme(rien si sexe=m)</font></td>´;
. ..

echo ´</tr>´."\n";
}
echo ´</table>´."\n";
}

Merci d´avance...

Et une derniere question: est-il possible ´en cliquant sur un lien, ouvrir une autre fenetre qui s´imprime automatiquement???

godnicolas99
godnicolas99
Niveau 4
24 mars 2004 à 15:24:24

< ?php
$resultaction = mysql_query("SELECT sexe FROM membre");
$row = mysql_fetch_array($resultaction);
$sexe = $row["sexe"];
if ( ($sexe == " f"){
if($total) {
/ / debut du tableau
echo ´<table bgcolor="#FFFFFF" width="100%">´."\n";
echo ´<TR>´;
. . .
echo ´<TD WIDTH="10" bgcolor="#669999" VALIGN="TOP" COLSPAN=2><font size="1"><b>Sexe</b></font></TD>´;
. . .
echo ´</TR>´;
echo ´<TR>´;
. . .
echo ´</TR>´."\n";
while($row = mysql_fetch_array($result)) {
echo ´<tr>´;
. . .
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">ici le resultat homme ( rien si sexe=f)</font></td>´;
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">ici le resultat femme(rien si sexe=m)</font></td>´;
. . .

echo ´</tr>´."\n";
}
echo ´</table>´."\n";
}
} else {
echo " tes un mec lol";
}
? >

; )
http://grizz-land.com

godnicolas99
godnicolas99
Niveau 4
24 mars 2004 à 15:26:33

merde :s

voila fait comme ca :d

< ?php
$resultaction = mysql_query("SELECT sexe FROM membre");
$row = mysql_fetch_array($resultaction);
$sexe = $row["sexe"];
if ( ($sexe == " f"){
if($total) {
/ / debut du tableau
echo ´<table bgcolor="#FFFFFF" width="100%">´."\n";
echo ´<TR>´;
. . .
echo ´<TD WIDTH="10" bgcolor="#669999" VALIGN="TOP" COLSPAN=2><font size="1"><b>Sexe</b></font></TD>´;
. . .
echo ´</TR>´;
echo ´<TR>´;
. . .
echo ´</TR>´."\n";
while($row = mysql_fetch_array($result)) {
echo ´<tr>´;
. . .
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">ici le resultat femme(rien si sexe=m)</font></td>´;
. . .

echo ´</tr>´."\n";
}
echo ´</table>´."\n";
}
} else {
if($total) {
/ / debut du tableau
echo ´<table bgcolor="#FFFFFF" width="100%">´."\n";
echo ´<TR>´;
. . .
echo ´<TD WIDTH="10" bgcolor="#669999" VALIGN="TOP" COLSPAN=2><font size="1"><b>Sexe</b></font></TD>´;
. . .
echo ´</TR>´;
echo ´<TR>´;
. . .
echo ´</TR>´."\n";
while($row = mysql_fetch_array($result)) {
echo ´<tr>´;
. . .
echo ´<td bgcolor="#CCCCCC" align="center"><font size="1">ici le resultat homme ( rien si sexe=f)</font></td>´;
. . .

echo ´</tr>´."\n";
}
echo ´</table>´."\n";
}
}
? >

Sous forums
  • Aide à l'achat Mac
  • Création de Jeux
  • Linux
  • Programmation
  • Création de sites web
  • Internet
  • Steam Deck
  • Macintosh
  • Hardware
La vidéo du moment