bonjour à tous,
Voici une petite question :
J'ai une page qui va récupérer les données dans ma BDD à certaines conditions.
Je place les résultats dans un tableau.
Je voudrais que lorsqu'il n'y a pas de résultats, il ne m'affiche pas ce tableau.
Voici mon code :
Voici une petite question :
J'ai une page qui va récupérer les données dans ma BDD à certaines conditions.
Je place les résultats dans un tableau.
Je voudrais que lorsqu'il n'y a pas de résultats, il ne m'affiche pas ce tableau.
Voici mon code :
<?php
$abstract=$_GET['page']; //tu récup dans une variable "nom" l'info que tu as passé grâce à l'url
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Stéphane Gueulette</title>
<link href="../../style_general.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
font-size: 18;
font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF">
<table width="600" border="0" align="center">
<tr>
<td><div align="center"><img src="../../site/images/abstract.jpg" width="150" height="52" /></div></td>
</tr>
<tr>
<td>
<?php do { ?>
<table width="580" height="250" border="0" align="center" background="../../site/images/cadre3.jpg">
<tr >
<td height="21" colspan="3" class="texte2">
<?php
mysql_connect("********", "********", "********");
mysql_select_db("***********");
$query_clients = "SELECT * FROM voscreations WHERE `categorie` ='$page' AND valeur ='true' ";
$clients = mysql_query($query_clients) or die(mysql_error());
$row_clients = mysql_fetch_assoc($clients);
$totalRows_clients = mysql_num_rows($clients);
if ($totalRows_clients == 0) {
echo 'Aucun résultat retourné.';
}
else {
// Récupération des résultats et affichage
}
mysql_fetch_assoc($clients);
$nom = $row_clients['nom'];
$lienfichier = $row_clients['lienfichier'];
$auteur = $row_clients['auteur'];
$emailauteur = $row_clients['emailauteur'];
?>
</td>
</tr>
<tr >
<td class="texte2"><div align="center"><span class="style1"><?php echo $row_clients['nom']; ?></span></div></td>
<td colspan="2" class="texte2"><span class="texte2">Créé par <?php echo $row_clients['auteur']; ?></span></td>
</tr>
<tr>
<td width="34%" align="center" valign="top" class="texte2">
<? echo "<img width='150' border='1' src=".$row_clients['lienfichier'].">"; ?>
<div align="center"></div>
<div align="center"><br />
<span class="texte1">
<?
echo "<a href=".$row_clients['lienfichier']." target=\'_blank'>Voir en grand</a> ";
?>
</span></div></td>
<td width="53%" valign="top" class="texte1"><span class="texte1"><?php echo $row_clients['emailauteur']; ?></span> </td>
<td width="13%" valign="top" class="texte1"> </td>
</tr>
<tr>
<td colspan="3" class="texte2">
</td>
</tr>
<tr>
<td height="21" colspan="3" class="texte2"> </td>
</tr>
</table>
<?php } while ($row_clients = mysql_fetch_assoc($clients)); ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="textecontact"> </td>
</tr>
</table>
</body>
</html>