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
| <?php
$requete='select * from auteur';
$reponse=mysql_query($requete);
echo "<br/> <br/> <br/>";
//il suffit maintenant de faire une boucle pour lister les composant de la table :
$res = mysql_query($requete);
echo '<table border="1"><tr>';
for ($i = 0; $i < mysql_num_fields($res); $i++) {
echo '<th>';
echo mysql_field_name($res, $i);
echo '</th>';
}
echo '</tr>';
while ($row = mysql_fetch_row($res)) {
echo '<tr>';
for ($j = 0; $j < count($row); $j++) {
echo '<td>';
echo $row[$j];
echo '</td>';
}
echo '</tr>';
}
?> |