Nombre de photos à afficher selon l'id ??????
Fermé
teler
Messages postés
86
Date d'inscription
vendredi 11 juillet 2008
Statut
Membre
Dernière intervention
9 mars 2010
-
10 janv. 2009 à 12:11
teler Messages postés 86 Date d'inscription vendredi 11 juillet 2008 Statut Membre Dernière intervention 9 mars 2010 - 11 janv. 2009 à 11:15
teler Messages postés 86 Date d'inscription vendredi 11 juillet 2008 Statut Membre Dernière intervention 9 mars 2010 - 11 janv. 2009 à 11:15
A voir également:
- Nombre de photos à afficher selon l'id ??????
- Https //id.sonyentertainmentnetwork.com/id/management/ ✓ - Forum PS4
- Partage de photos - Guide
- Email id - Forum Consommation et internet
- Le fichier contient un programme écrit en python. le programme construit un mot secret mais il ne l'affiche pas. modifiez ce programme afin que à chaque itération de la boucle : la variable a augmente de 2 la variable b diminue de 1 ajoutez une instruction pour faire afficher le mot secret construit. quel est ce mot secret ? ✓ - Forum Python
- Le fichier contient le nombre de voyageurs dans 3 gares. dans la cellule b5, saisissez une formule qui calcule le total et se met à jour si on change une valeur du tableau. quel total obtenez-vous ? quelle formule avez-vous saisie ? ✓ - Forum Excel
2 réponses
Bonjour,
Hum tu fais une boucle, tu fais un select * from photos where id= "id_annonce".
Et ensuite tu fais une boucle et pour chaque occurence tu les affiche.
Du coup une annonce qui n'a que 2 photos en base ca va boucler 2 fois et tu en auras 2 voilà.
Bonne chance !
Hum tu fais une boucle, tu fais un select * from photos where id= "id_annonce".
Et ensuite tu fais une boucle et pour chaque occurence tu les affiche.
Du coup une annonce qui n'a que 2 photos en base ca va boucler 2 fois et tu en auras 2 voilà.
Bonne chance !
teler
Messages postés
86
Date d'inscription
vendredi 11 juillet 2008
Statut
Membre
Dernière intervention
9 mars 2010
5
11 janv. 2009 à 11:15
11 janv. 2009 à 11:15
Je ne suis pas sure d'avoir compris, en fait ,
voici mon code : sur ma première page, je fais une boucle while pour afficher toute les annonces selon ma recherche et j'affiche qu'une image pour chaque annonce.
$retour_messages=mysql_query('SELECT * FROM produits ORDER BY id DESC LIMIT '.$premiereEntree.', '.$messagesParPage.'');
while($data=mysql_fetch_assoc($retour_messages)) // On lit les entrées une à une grâce à une boucle
{
echo
'<div class="hautmarge"><img src="images/haut.png" /></div>
<div class="bas2"><div style="padding-bottom:20px"></div>
<form method="post" action="traitement.php" class="formulaire">
<table width="370" height="140">
<tr>
<td><div class="texteannonce">'.$data['type'].'</div></td>
<td></td>
</tr>
<tr>
<td>'.$data['nbre'].' pièces '.$data['surf'].' m2</td>
<td align="right">'.$data['prix'].' €</td>
</tr>
<tr>
<td><a href="annonce.php?ref='.$data['id'].' &prix='.$data['prix'].' &photo='.$data['photo'].' &photo2='.$data['photo2'].' &photo3='.$data['photo3'].'&photo4='.$data['photo4'].' &type='.$data['type'].' &surf='.$data['surf'].' &nbre='.$data['nbre'].' &description='.$data['description'].'">'.$data['description'].'</a></td>
<td align="right"> <a href="photos_annonces/'.$data['photo'].'" rel="shadowbox" title="'.$data['nbre'].' pièces, '.$data['surf'].' m2" >
<img height="100px" class="no_cadre" src="photos_annonces/' .$data['photo']. '"/></a></td>
</tr>
<tr><td></td><td align="right">réf : '.$data['id'].'</td></tr>
</table></form></div><div style="padding-bottom:20px"></div>';
}
il y a un lien sur la photo qui nous renvois sur une autre page , ( je fais passer toutes les infos dans le lien et je l'ai recupere sur ma page où il ya qu'une seule annonce par un $_GET pour afficher les spécificité du produit.
seulement là je lui demande d'afficher tout les champs de ma bdd, (j'ai creer 4 champs pour les noms des photos)
mais si il n'y a que 3 noms de photos, je vais avoir un icome image manquante.
Je n'ai surement pas bien proceder.
VOICI le code de la page qui recupere les infos par _GET :
<form class="formulaire">
<table width="370" height="236">
<TR height="10">
<TD></TD>
<TD></TD>
</TR>
<tr>
<td width="237"><div class="texteannonce"><?php echo $_GET['type'];?></div></td>
<td width="121"></td>
</tr>
<tr>
<td height="54"><?php echo $_GET['nbre'];?>
pièces
<?php echo $_GET['surf'];?> m2</td>
<td align="right"><?php echo $_GET['prix'];?> €</td>
</tr>
<tr>
<td valign="top"><?php echo $_GET['description']; ?> </td>
<td align="right" valign="top"><a href="photos_annonces/<?php echo $_GET['photo']; ?>" rel="shadowbox" title="<?php echo $_GET['nbre']; ?>pièces, <?php echo $_GET['surf']; ?> m2"><img src="photos_annonces/<?php echo $_GET['photo']; ?>" width="60px" class="no_cadre"/></a><a href="photos_annonces/<?php echo $_GET['photo']; ?>" rel="shadowbox" title="<?php echo $_GET['nbre']; ?>pièces, <?php echo $_GET['surf']; ?> m2"><img src="photos_annonces/<?php echo $_GET['photo']; ?>" width="60px" class="no_cadre"/></a><br />
<a href="photos_annonces/<?php echo $_GET['photo3']; ?>" rel="shadowbox" title="<?php echo $_GET['nbre']; ?>pièces, <?php echo $_GET['surf']; ?> m2"><img src="photos_annonces/<?php echo $_GET['photo']; ?>" width="60px" class="no_cadre"/></a><a href="photos_annonces/<?php echo $_GET['photo4']; ?>" rel="shadowbox" title="<?php echo $_GET['nbre']; ?>pièces, <?php echo $_GET['surf']; ?> m2"><img src="photos_annonces/<?php echo $_GET['photo']; ?>" width="60px" class="no_cadre"/></a><br />
<br />
réf : <?php echo $_GET['ref'];?></td>
</tr>
</table>
</form>
voici mon code : sur ma première page, je fais une boucle while pour afficher toute les annonces selon ma recherche et j'affiche qu'une image pour chaque annonce.
$retour_messages=mysql_query('SELECT * FROM produits ORDER BY id DESC LIMIT '.$premiereEntree.', '.$messagesParPage.'');
while($data=mysql_fetch_assoc($retour_messages)) // On lit les entrées une à une grâce à une boucle
{
echo
'<div class="hautmarge"><img src="images/haut.png" /></div>
<div class="bas2"><div style="padding-bottom:20px"></div>
<form method="post" action="traitement.php" class="formulaire">
<table width="370" height="140">
<tr>
<td><div class="texteannonce">'.$data['type'].'</div></td>
<td></td>
</tr>
<tr>
<td>'.$data['nbre'].' pièces '.$data['surf'].' m2</td>
<td align="right">'.$data['prix'].' €</td>
</tr>
<tr>
<td><a href="annonce.php?ref='.$data['id'].' &prix='.$data['prix'].' &photo='.$data['photo'].' &photo2='.$data['photo2'].' &photo3='.$data['photo3'].'&photo4='.$data['photo4'].' &type='.$data['type'].' &surf='.$data['surf'].' &nbre='.$data['nbre'].' &description='.$data['description'].'">'.$data['description'].'</a></td>
<td align="right"> <a href="photos_annonces/'.$data['photo'].'" rel="shadowbox" title="'.$data['nbre'].' pièces, '.$data['surf'].' m2" >
<img height="100px" class="no_cadre" src="photos_annonces/' .$data['photo']. '"/></a></td>
</tr>
<tr><td></td><td align="right">réf : '.$data['id'].'</td></tr>
</table></form></div><div style="padding-bottom:20px"></div>';
}
il y a un lien sur la photo qui nous renvois sur une autre page , ( je fais passer toutes les infos dans le lien et je l'ai recupere sur ma page où il ya qu'une seule annonce par un $_GET pour afficher les spécificité du produit.
seulement là je lui demande d'afficher tout les champs de ma bdd, (j'ai creer 4 champs pour les noms des photos)
mais si il n'y a que 3 noms de photos, je vais avoir un icome image manquante.
Je n'ai surement pas bien proceder.
VOICI le code de la page qui recupere les infos par _GET :
<form class="formulaire">
<table width="370" height="236">
<TR height="10">
<TD></TD>
<TD></TD>
</TR>
<tr>
<td width="237"><div class="texteannonce"><?php echo $_GET['type'];?></div></td>
<td width="121"></td>
</tr>
<tr>
<td height="54"><?php echo $_GET['nbre'];?>
pièces
<?php echo $_GET['surf'];?> m2</td>
<td align="right"><?php echo $_GET['prix'];?> €</td>
</tr>
<tr>
<td valign="top"><?php echo $_GET['description']; ?> </td>
<td align="right" valign="top"><a href="photos_annonces/<?php echo $_GET['photo']; ?>" rel="shadowbox" title="<?php echo $_GET['nbre']; ?>pièces, <?php echo $_GET['surf']; ?> m2"><img src="photos_annonces/<?php echo $_GET['photo']; ?>" width="60px" class="no_cadre"/></a><a href="photos_annonces/<?php echo $_GET['photo']; ?>" rel="shadowbox" title="<?php echo $_GET['nbre']; ?>pièces, <?php echo $_GET['surf']; ?> m2"><img src="photos_annonces/<?php echo $_GET['photo']; ?>" width="60px" class="no_cadre"/></a><br />
<a href="photos_annonces/<?php echo $_GET['photo3']; ?>" rel="shadowbox" title="<?php echo $_GET['nbre']; ?>pièces, <?php echo $_GET['surf']; ?> m2"><img src="photos_annonces/<?php echo $_GET['photo']; ?>" width="60px" class="no_cadre"/></a><a href="photos_annonces/<?php echo $_GET['photo4']; ?>" rel="shadowbox" title="<?php echo $_GET['nbre']; ?>pièces, <?php echo $_GET['surf']; ?> m2"><img src="photos_annonces/<?php echo $_GET['photo']; ?>" width="60px" class="no_cadre"/></a><br />
<br />
réf : <?php echo $_GET['ref'];?></td>
</tr>
</table>
</form>