<?php session_start();
if(!empty($_SESSION['user_connect_id']))
{
require '../config.php';
 $output ='<table class="table table-striped table-hover table_auteurs" >
                <thead>
                    <tr>
      
                        <th>Nom</th>
                        <th>Prenom</th>
                        <th>Actions</th>
                    </tr>
                </thead>
           

                                       





                                    <tbody>

        
                    ';
                 
if($_POST['id_doc']){
      $id_doc=pg_escape_string($con,$_POST['id_doc']);
      

        $req_sql= "SELECT *,a.id_auteur FROM auteurs as a ,documents as d, doc_auteur as da WHERE da.id_doc='$id_doc' and a.id_auteur=da.id_auteur and d.id=da.id_doc" ;
     $resultats= pg_query($con,$req_sql);


     if (pg_num_rows($resultats)>0)
  
  {
   while($row = pg_fetch_array($resultats)){
   $output .=' 
   <tr><td>  '.$row['nom'] .' </td>
        <td> '.  $row['prenom'] .'</td> 

 <td>
      

                    <button type="button" class="btn btn-danger btn-xs sup_aut"    data="'. $row['id_auteur'].'" >Supprimer</button>
                        </td>
</tr> </tbody></table>';                
          }}           
    }
echo $output;
  }



  ?>
