1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
<? include("../inc/config.php");
$aff="{monrestodb1\":<br>";
$query = "SELECT * from cp where statut ='visible' ";
$req = mysql_query($query) or die(mysql_error());
$num=mysql_num_rows($req);
$compteur=1;$compteur2=1;
while ($data = mysql_fetch_assoc($req))
{
$aff=$aff."{\"nomzone\" :";
$zone=$data['cp'];
$zone_search=$zone.",";
$aff=$aff.$zone;
$query_part_id = "SELECT distinct PartID from affectrestocp where Zip LIKE '%$zone_search%' ";
$req_part_id = mysql_query($query_part_id) or die(mysql_error());
$num2=mysql_num_rows($req_part_id);
$aff=$aff." <br> nomrest : \" {";
while ($data_part_id = mysql_fetch_assoc($req_part_id))
{
$id_part=$data_part_id['PartID'];
$query_part = "SELECT nom from partenaires where id='$id_part' ";
$req_part = mysql_query($query_part) or die(mysql_error());
while ($data_part = mysql_fetch_assoc($req_part))
{
$nom_part=$data_part['nom'];
$aff=$aff."\"$nom_part\"";
}
if($compteur2<$num2){$aff=$aff.",";}
$compteur2++;
}
$aff=$aff." }<br>";
$compteur2=1;
$aff=$aff."}<br>";
if($compteur<$num){$aff=$aff."";}
$compteur++;
}
$aff=$aff."}";
echo $aff;
?> |