Lister le contenu d'une table dans un tableau HTML
Bonjour
J'ai un probleme. Dans la table j ai 4 lignes ayant le même Rank = 4. Je voudrai les sélectionner dans un tableau. Mais je n'ai qu'une seule ligne qui s'affiche et non les 4 lignes. La requête, je suis sur qu'elle est bonne puisque elle affiche au moins une ligne. mais je n'arrive pas afficher les 3 autres. Pourquoi la je ne vois pas !
Comment faire pour tout faire afficher dans un tableau à 4 colonnes?
Voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
<? session_start() ?>
<?
$db = mysql_connect("localhost","root","");
mysql_select_db("essai");
$cat = $_POST['categorie'];
$sql = "SELECT a.photo,a.nom,a.prenom,a.adresse FROM fr_user a WHERE a.rank like '$cat'";
$res = mysql_query($sql,$db);
$rows = mysql_fetch_object($res);
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
</head>
<body>
<table border="1" align="center">
<tr>
<th colspan="4"><b>Le Listing</b></th>
</tr>
<tr>
<td><b>photo :</b></td>
<td><b>nom :</b></td>
<td><b>prenom :</b></td>
<td><b>adresse :</b></td>
</tr>
<tr>
<td><b><? echo $rows->photo; ?></b></td>
<td><b><? echo $rows->nom; ?></b></td>
<td><b><? echo $rows->prenom; ?></b></td>
<td><b><? echo $rows->adresse; ?></b></td>
</tr>
</table>
</body>
</html> |
Merci d'avance!!!