M'enfin on voit bien que le tient il est pas arrivé deuxième
Code : Tout sélectionner
<div id="contenu">
<?php do { ?>
<table height="110px" width="461px" border="0" cellspacing="0" cellpadding="0" background="vignette_annuaire.gif">
<tr>
<td class="photo" rowspan="4" height="97px" width="140px" ><img src="<?php echo $row_rs_camping['urlphoto4_camping']; ?>" alt="<?php echo $row_rs_camping['altphoto1_camping']; ?>"/></td>
<td class="nom" colspan="2" width="315px" height="30px"><?php echo $row_rs_camping['nom_camping']; ?></td>
</tr>
<tr>
<td width="315px" height="24px" colspan="2"><span class="Style1"><?php echo $row_rs_camping['cp_camping']; ?> <?php echo $row_rs_camping['ville_camping']; ?></span></td>
</tr>
<tr>
<td colspan="2" width="315px" height="18px" valign="top"><span class="Style1"><?php echo $row_rs_camping['dateouverture_camping']; ?></span></td>
</tr>
<tr>
<td width="150px" height="25px" valign="top"><span class="Style1"><?php echo '<img src="Images/etoile'.$row_rs_camping['nbetoiles_camping'].'.gif" alt="Camping '.$row_rs_camping['nbetoiles_camping'].' étoiles"></img>'; ?></span></td>
<td width="165px" height="25px" valign="top"><a href="http://develop.web.free.fr/template_generic2.php?num_camping=<?php echo $row_rs_camping['num_camping']; ?>"><span class="Style1"> Fiche complète</span></a></td>
</tr>
</table>
<?php } while ($row_rs_camping = mysql_fetch_assoc($rs_camping)); ?>
</div>Code : Tout sélectionner
<?php do { ?>
<table class="tableau" height="110px" width="461px" border="0" cellspacing="0" cellpadding="0" background="vignette_annuaire.gif">
<tr>
<td class="photo" rowspan="4" height="97px" width="140px" ><img src="<?php echo $row_rs_camping['urlphoto4_camping']; ?>" alt="<?php echo $row_rs_camping['altphoto1_camping']; ?>"/></td>
<td class="nom" colspan="2" width="315px" height="30px"><?php echo $row_rs_camping['nom_camping']; ?></td>
</tr>
<tr>
<td width="315px" height="24px" colspan="2"><span class="Style1"><?php echo $row_rs_camping['cp_camping']; ?> <?php echo $row_rs_camping['ville_camping']; ?></span></td>
</tr>
<tr>
<td colspan="2" width="315px" height="18px" valign="top"><span class="Style1"><?php echo $row_rs_camping['dateouverture_camping']; ?></span></td>
</tr>
<tr>
<td width="150px" height="25px" valign="top"><span class="Style1"><?php echo '<img src="Images/etoile'.$row_rs_camping['nbetoiles_camping'].'.gif" alt="Camping '.$row_rs_camping['nbetoiles_camping'].' étoiles"></img>'; ?></span></td>
<td width="165px" height="25px" valign="top"><a href="http://develop.web.free.fr/template_generic2.php?num_camping=<?php echo $row_rs_camping['num_camping']; ?>"><span class="Style1"> Fiche complète</span></a></td>
</tr>
</table>
<?php } while ($row_rs_camping = mysql_fetch_assoc($rs_camping)); ?>
do {
// Tes instructions
} while (condition)
Le problème c'est si tu n'as pas de données, car tu exécutes au mois une fois la boucle.while (condition) {
// Tes instructions
}
Pour résumer, ta structure// on crée la table avant le début de la boucle
<table>
<?php while ($row_rs_camping = mysql_fetch_assoc($rs_camping)) { ?>
<tr> <!-- Création d'une ligne -->
<td> <!-- Création d'une cellule, celle de gauche -->
<!-- Contenu de la cellule gauche -->
<img class="un_nom_de_class_CSS" .... />
<span class="un_nom_de_class_CSS_différent">Ici je mets mon texte</span>
<a ......>mon lien </a>
</td>
<td> <!-- Création d'une cellule, celle de droite-->
<!-- Contenu de la cellule gauche -->
<img class="un_nom_de_class_CSS" .... />
<span class="un_nom_de_class_CSS_différent">Ici je mets mon texte</span>
<a ......>mon lien </a>
</td>
</tr>
<?php } // Fin de la boucle ?>
<!-- Fermeture de la table -->
</table>
Construis déjà la structure, on s'occupe après de la présentation.Code : Tout sélectionner
<?php
$currentPage = $_SERVER["PHP_SELF"];
?>
<?php require_once('connections/free.php'); ?>
<?php
$maxRows_rs_camping = 4;
$pageNum_rs_camping = 0;
if (isset($_GET['pageNum_rs_camping'])) {
$pageNum_rs_camping = $_GET['pageNum_rs_camping'];
}
$startRow_rs_camping = $pageNum_rs_camping * $maxRows_rs_camping;
mysql_select_db($database_conn_develop, $conn_develop);
$query_rs_camping = "SELECT * FROM tbl_camping ORDER BY rand()";
$query_limit_rs_camping = sprintf("%s LIMIT %d, %d", $query_rs_camping, $startRow_rs_camping, $maxRows_rs_camping);
$rs_camping = mysql_query($query_limit_rs_camping, $conn_develop) or die(mysql_error());
$row_rs_camping = mysql_fetch_assoc($rs_camping);
if (isset($_GET['totalRows_rs_camping'])) {
$totalRows_rs_camping = $_GET['totalRows_rs_camping'];
} else {
$all_rs_camping = mysql_query($query_rs_camping);
$totalRows_rs_camping = mysql_num_rows($all_rs_camping);
}
$totalPages_rs_camping = ceil($totalRows_rs_camping/$maxRows_rs_camping)-1;
$queryString_rs_camping = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rs_camping") == false &&
stristr($param, "totalRows_rs_camping") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rs_camping = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rs_camping = sprintf("&totalRows_rs_camping=%d%s", $totalRows_rs_camping, $queryString_rs_camping);
?>Code : Tout sélectionner
// on crée la table avant le début de la boucle
<table>
<?php while ($row_rs_camping = mysql_fetch_assoc($rs_camping)) { ?>
<tr> <!-- Création d'une ligne -->
<td> <!-- Création d'une cellule, celle de gauche -->
<!-- Contenu de la cellule gauche -->
<img class="photo" src="<?php echo $row_rs_camping['urlphoto4_camping']; ?>" alt="<?php echo $row_rs_camping['altphoto1_camping']; ?>" />
<span class="texte"><h1><?php echo $row_rs_camping['nom_camping']; ?></h1> <p><?php echo $row_rs_camping['cp_camping']; ?> <?php echo $row_rs_camping['ville_camping']; ?></p> <p><?php echo $row_rs_camping['dateouverture_camping']; ?></p> <p><?php echo '<img src="Images/etoile'.$row_rs_camping['nbetoiles_camping'].'.gif" alt="Camping '.$row_rs_camping['nbetoiles_camping'].' étoiles"></img>'; ?></p></span>
<a href="http://develop.web.free.fr/template_generic2.php?num_camping=<?php echo $row_rs_camping['num_camping']; ?>">Fiche complète</a>
</td>
<td> <!-- Création d'une cellule, celle de droite-->
<!-- Contenu de la cellule gauche -->
<img class="photo" src="<?php echo $row_rs_camping['urlphoto4_camping']; ?>" alt="<?php echo $row_rs_camping['altphoto1_camping']; ?>" />
<span class="texte"><h1><?php echo $row_rs_camping['nom_camping']; ?></h1> <p><?php echo $row_rs_camping['cp_camping']; ?> <?php echo $row_rs_camping['ville_camping']; ?></p> <p><?php echo $row_rs_camping['dateouverture_camping']; ?></p> <p><?php echo '<img src="Images/etoile'.$row_rs_camping['nbetoiles_camping'].'.gif" alt="Camping '.$row_rs_camping['nbetoiles_camping'].' étoiles"></img>'; ?></p></span>
<a href="http://develop.web.free.fr/template_generic2.php?num_camping=<?php echo $row_rs_camping['num_camping']; ?>">Fiche complète</a>
</td>
</tr>
<?php } // Fin de la boucle ?>
<!-- Fermeture de la table -->
</table>