[insert_php]

require (“Gestion_LOHAD_2.php”);

// Detection s’il s’agit d’un user agent smartphones
$ua = $_SERVER[‘HTTP_USER_AGENT’];
if (preg_match(‘/iphone/i’,$ua) || preg_match(‘/android/i’,$ua) || preg_match(‘/blackberry/i’,$ua) || preg_match(‘/symb/i’,$ua) || preg_match(‘/ipad/i’,$ua) || preg_match(‘/ipod/i’,$ua) || preg_match(‘/phone/i’,$ua) )
{
$type_nav=”mobile”;
}

$id_tournee = $_GET[‘id_tournee’];
$id_tournee = $conn->real_escape_string($_GET[‘id_tournee’]);
//echo “$id_tournee”;

//////////////////////
//requête tournée
//////////////////////
$rep_tour = (“SELECT tb_tournee.id_tournee, tb_tournee.tournee, tb_tournee.image_tour, tb_tournee.date_deb FROM tb_tournee WHERE tb_tournee.id_tournee=$id_tournee ORDER BY date_deb DESC”);

$res_rep_tour = $conn->query($rep_tour);
$data1 = mysqli_fetch_assoc($res_rep_tour);
$tournee = $data1[‘tournee’];

//////////////////////
//Nb Concerts
//////////////////////
$compteur_tour = (“SELECT COUNT(*) AS nbr FROM tb_concert, tb_leg WHERE tb_concert.id_leg = tb_leg.id_leg AND tb_leg.id_tournee = $id_tournee”) ;
$res_compteur_tour = $conn->query($compteur_tour);
$data2 = mysqli_fetch_assoc($res_compteur_tour);
$total_concerts = $data2[‘nbr’];
if ($total_concerts == 1)
{
$total_concerts = “$total_concerts concert”;
}
else
{
$total_concerts = “$total_concerts concerts”;
}

echo “$tournee – $total_concerts “;

$reponse_leg = (“SELECT * FROM tb_leg WHERE id_tournee = $id_tournee ORDER BY numero ASC”);
$res_reponse_leg = $conn->query($reponse_leg);

while($data3 = mysqli_fetch_assoc($res_reponse_leg))
{
$idleg = $data3[‘id_leg’];
$leg = $data3[‘leg’];

$compteur_leg = (“SELECT COUNT(*) AS nbr_leg FROM tb_concert WHERE id_leg = $idleg”);
$res_compteur_leg = $conn->query($compteur_leg);
$data4 = mysqli_fetch_assoc($res_compteur_leg);
$rep_compteur_tour = $data4[‘nbr_leg’];

if ($rep_compteur_tour == 1)
{
$rep_compteur_tour = “$rep_compteur_tour concert”;
}
else
{
$rep_compteur_tour = “$rep_compteur_tour concerts”;
}

echo “

“;
echo “

“;
echo “

“;
echo “

“;
//////////////////////////////////////////////
//requête pour les concerts de chaque leg
//////////////////////////////////////////////
$reponse_concert = (“SELECT tb_concert.nbr_chanson, tb_concert.id_salle, tb_salle.id_salle, tb_salle.id_ville, tb_ville.id_ville, tb_ville.id_pays, tb_pays.id_pays, tb_salle.salle, tb_ville.ville, tb_pays.pays, tb_concert.date, tb_concert.id_concert FROM tb_concert, tb_salle, tb_ville, tb_pays WHERE tb_concert.id_leg = $idleg AND tb_concert.id_salle = tb_salle.id_salle AND tb_salle.id_ville = tb_ville.id_ville AND tb_ville.id_pays = tb_pays.id_pays ORDER BY tb_concert.date ASC”);
$res_reponse_concert = $conn->query($reponse_concert);

//echo “

“;

while($data5 = mysqli_fetch_assoc($res_reponse_concert))

{
$date_concert = $data5[‘date’];
$j1=substr($date_concert, 8, 2);
$m1=substr($date_concert, 5, 2);
$a1=substr($date_concert, 0, 4);
$date_concert =$j1.’/’.$m1.’/’.$a1;

$id_concert =$data5[‘id_concert’];
$ville =$data5[‘ville’];
$pays =$data5[‘pays’];
$salle =$data5[‘salle’];

$reponse_nb_titres = (“SELECT COUNT(‘id_chanson’) as TOT FROM tb_unite WHERE id_concert=$id_concert”);
$res_reponse_nb_titres = $conn->query($reponse_nb_titres);
$data6 = mysqli_fetch_assoc($res_reponse_nb_titres);
$nbr_chanson =$data6[‘TOT’];

if ($nbr_chanson == 0)
{
$nbr_chanson = “”;
}
else
{
$nbr_chanson = “ $nbr_chanson titres”;

}

echo “

“;
echo “

“;
echo “

“;
echo “

“;

}

}

echo “

$leg – $rep_compteur_tour
$date_concert – $ville – $pays – $salle $nbr_chanson

“;

mysqli_close($conn);
[/insert_php]