Lister une table de sgbd dans un tableau html
Posté : 07 juil. 2014, 17:36
bonjour chers tous;
je veux afficher dans un tableau html le contenu d'une table personne (nom, prénoms, age) autant de fois qu'il y a d'enregistrement mais ...avec mon code il n'y a pas de retour a la ligne . aider moi !!!!!
code
je veux afficher dans un tableau html le contenu d'une table personne (nom, prénoms, age) autant de fois qu'il y a d'enregistrement mais ...avec mon code il n'y a pas de retour a la ligne . aider moi !!!!!
code
<?php
mysql_connect('localhost','root','');
mysql_select_db('romaric');
?>
<!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>
<form method="post" action="tableau.php" name="essai">
<table>
<tr>
<th>
nom
</th>
<th>
prenoms
</th>
<th>
age
</th>
</tr>
<tr>
<td>
<?php
$req="select * from homme";
$exe=mysql_query($req);
while( $rep=mysql_fetch_array($exe))
{
?>
<?php echo $rep['nom'] ?>
<?php
}
?>
</td>
</tr>
<tr>
<td>
<?php
$req="select * from homme";
$exe=mysql_query($req);
while( $rep=mysql_fetch_array($exe))
{
?>
<?php echo $rep['prenoms'] ?>
<?php
}
?>
</td>
</tr>
<tr>
<td>
<?php
$req="select * from homme";
$exe=mysql_query($req);
while( $rep=mysql_fetch_array($exe))
{
?>
<?php echo $rep['age'] ?>
<?php
}
?>
</td>
</tr>
</table>
</form>
</body>
</html>