<?php

    
function afficherResultats ($result) {
        echo 
"<table>" ;
        echo 
"<thead> <tr> ";
                        
        
//on recupere le nom des colonnes
        
$titres $result->fetch_fields() ;
        
        foreach (
$titres as $colonne) {
            echo 
"<th> " $colonne->name " </th>" ;
        }
        
        
//on recupere les donnees
        
while ($ligne $result->fetch_object()) {
            echo 
"<tr>" ;
            foreach (
$ligne as $colonne=>$val) {
                echo 
"<td> " $val " </td>" ;
            }
            echo 
"</tr>" ;
        }
                        
        echo 
"</tbody> </table>" ;        
    }
    
?>