<?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_facture where id_client = ".$id;
// echo $query;
$result = @$db->query($query);
$outp = array();
$cont = 0;
if($result !== false){
	foreach($result as $row){
		$bl = array();
		$bl = explode(",", $row["ref_bl"]);
		$count_bl = count($bl);
		if($count_bl < 1){
			foreach ($bl as &$value) {
				$outp[$cont] = $value ;
				$cont++;
			} 		
		}else{
			foreach ($bl as &$value) {
				$outp[$cont] = $value ;
				$cont++;
			} 
		}		
	} 
}	

	echo json_encode($outp);
	





?>