par
stefane321 » 12 déc. 2005, 22:25
Bonjour,
J'aimerais savoir comment faire pour affichier un message "Il n'y a pas d'enregistrement dans la table" lorsque ma table est vide.
Voici mon code:
Code : Tout sélectionner
$c = @mysql_connect($host,$login,$password);
@mysql_select_db($db,$c);
$sql = "select * from formations order by id desc LIMIT $debut,$nb ";
echo "<h4 align=\"center\">Les formations offertes</h4>\n";
$result = mysql_query($sql,$c);
// parcours des résultats
while($row = mysql_fetch_array($result) )
{
echo "<table width='100%' align=\"center\">\n";
echo "<tr>\n";
echo "<td valing=\"middle\"><IMG SRC=\"images/fleche2.jpg\" WIDTH=\"10\" HEIGHT=\"10\" BORDER=0 ALT=\"".StripSlashes($row["nom"])."\"> <a href=\"formations_details.php?id=".$row["id"]."\">".StripSlashes($row["nom"])."</a> </td>\n";
echo "<td align='right'><a href=\"formations_details.php?id=".$row["id"]."\">".$row["date"]."</a></td>\n";
echo "</tr>\n";
echo "</table>\n";
}
Merci!
Bonjour,
J'aimerais savoir comment faire pour affichier un message "Il n'y a pas d'enregistrement dans la table" lorsque ma table est vide.
Voici mon code:
[code]
$c = @mysql_connect($host,$login,$password);
@mysql_select_db($db,$c);
$sql = "select * from formations order by id desc LIMIT $debut,$nb ";
echo "<h4 align=\"center\">Les formations offertes</h4>\n";
$result = mysql_query($sql,$c);
// parcours des résultats
while($row = mysql_fetch_array($result) )
{
echo "<table width='100%' align=\"center\">\n";
echo "<tr>\n";
echo "<td valing=\"middle\"><IMG SRC=\"images/fleche2.jpg\" WIDTH=\"10\" HEIGHT=\"10\" BORDER=0 ALT=\"".StripSlashes($row["nom"])."\"> <a href=\"formations_details.php?id=".$row["id"]."\">".StripSlashes($row["nom"])."</a> </td>\n";
echo "<td align='right'><a href=\"formations_details.php?id=".$row["id"]."\">".$row["date"]."</a></td>\n";
echo "</tr>\n";
echo "</table>\n";
}[/code]
Merci!