<?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();
}


$query = "SELECT * from pm_facture ";
$result = @$db->query($query);
$cont = 0 ;
$outp = array();
if($result !== false){
	// $outp = $result->fetch();
	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{
			$outp[$cont] = $row["ref_bl"] ;
			$cont++;
		}
			
	} 
	
	echo json_encode($outp);
	
}	




?>