<?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>Medicament</th>
                        <th>Quantite</th>
                        <th>Posologie</th>
                         <th>Actions</th>
                    </tr>
                </thead>
           

                                       





                                    <tbody>

        
                    ';
                 
if($_POST['id_consult']){
      $id_consult=mysqli_escape_string($con,$_POST['id_consult']);
      $id_ord=mysqli_escape_string($con,$_POST['id_ord']);
      

      $req_sql= "SELECT *,o.id_ord FROM ordonnances as o ,medicaments as m,  
      ordonnance_medicament as om WHERE o.id_ord=om.id_ord and  m.id_medicament=om.id_med and o.id_ord='$id_ord '"; 
       $resultats= mysqli_query($con,$req_sql) or die('Query privacy_stars failed: ' . mysqli_error($con));



   
   while($row = mysqli_fetch_array($resultats)){
   $output .=' 
   <tr><td>  '.$row['nom_med'] .' </td>
        <td> '.  $row['quantite'] .'</td> 
        <td> '.  $row['posologie'] .'</td> 

 <td>
      

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



  ?>
