<?php
ini_set('display_errors', 0);

require_once("../../common/lib.php");
require_once("../../common/define.php");

if(!isset($_SESSION['user'])){
    header("Location: login.php");
    exit();
}

$id = $_GET["id"];

$query = "SELECT * FROM pm_bc_product where id_bc = ".$id;
$result = @$db->query($query);
if($result !== false){
	echo '<table align="center" cellpadding="6" cellspacing="6" border="1" width="100%"><tr><th>Désingnation</th><th>Qte</th><th>Colissage</th><th>Unité</th></tr>';
	foreach($result as $row){
		$query_p = "SELECT desingnation FROM pm_produitsachat where id = ".$row["name"];
		$result_p = @$db->query($query_p);
		if($result_p !== false){
			$row_p = $result_p->fetch();
			$desingnation = $row_p["desingnation"];
		}	
		
		$query_c = "SELECT name FROM pm_unite where id = ".$row["unite"];
		$result_c = @$db->query($query_c);
		if($result_c !== false){
			$row_c = $result_c->fetch();
			$unite = ucfirst($row_c["name"]);
		}
      	
		$qte = $row["qte"];
		$coulissage = $row["coulissage"];
		// $unite = $row["unite"];
		

		 echo '<tr><td>'.$desingnation.'</td><td>'.$qte.'</td><td>'.$coulissage.'</td><td>'.$unite.'</td></tr>';
     } 
	 echo '</table>';
	

}	




?>