<?php
$response = array();
$WILAYA = $_GET['WILAYA'];

require_once dirname(__FILE__) . '/db_connect.php';

$db = new DB_CONNECT();

$result = mysql_query("SELECT *FROM dist_mat WHERE WILAYA ='$WILAYA'") or die(mysql_error());

if (mysql_num_rows($result) > 0) {
            
$response["dist_mat"] = array();
    
    
while ($row = mysql_fetch_array($result)) {
        
$dist_mat1 = array();

$dist_mat1["ID"] = $row["ID"];
$dist_mat1["NAME"] = $row["NAME"];
$dist_mat1["ACTIVITY"] = $row["ACTIVITY"];        
$dist_mat1["ADRESS"] = $row["ADRESS"];
$dist_mat1["WILAYA"] = $row["WILAYA"];
$dist_mat1["TEL"] = $row["TEL"];
$dist_mat1["FAX"] = $row["FAX"];
$dist_mat1["LA"] = $row["LO"];
$dist_mat1["LA"] = $row["LO"];                  
        
array_push($response["dist_mat"], $dist_mat1);
    }
        
$response["success"] = 1;
    
echo json_encode($response);
} 
else {
    
$response["success"] = 0;
    
$response["message"] = "No products found";
    
echo json_encode($response);
}
?>
