<!DOCTYPE html>
<html>

    <head>

    </head>

    <body>

        <?php
        $q = intval($_GET['q']);
        // connexion a la base
        $db = mysqli_connect('localhost', 'root', 'm148r43a9Y@%Z','smartpassTest2');
           
        if(!$db){
            die("Erreur de connection :" .mysqli_error($db));
        }

        // selection de la base 
        mysqli_select_db($db, "ajax_demo");
        //Requete SQL
        $strSQL = "SELECT * FROM Parcours WHERE id = '".$q."'";
        $result = mysqli_query($db, $strSQL);

        if(mysqli_num_rows($result) == 0){
          echo "<p>Aucun champ ! '".$q."' </p>";
        }

        while($resultat = mysqli_fetch_array($result)){
            $point = $resultat["idPoints"];
            $decoupe = explode(",", $point);

            for($i = 0; $i < count($decoupe) ; $i++){
                echo "<br/>";
                $strSQL2 = "SELECT * FROM InformationsGenerales WHERE id = '".$decoupe[$i]."'";
                $result2 = mysqli_query($db, $strSQL2);
                    
                while($resultat2 = mysqli_fetch_array($result2)){
                    echo "<p style=display:none;>||". $resultat2["id"] ."||". $resultat2["Lattitude"] ."||". $resultat2["Longitude"] ."||". $resultat2["Visible"] ."||</p>";
                    echo "<br/>";
                }
            }

            for($i = 0; $i < count($decoupe) ; $i++){
                echo "<br/>";
                $strSQL3 = "SELECT * FROM DescriptionGenerale WHERE id = '".$decoupe[$i]."'";
                $result3 = mysqli_query($db, $strSQL3);
                    
                while($resultat3 = mysqli_fetch_array($result3)){
                    echo "<g style=display:none;>||". $resultat3["id"] ."||". $resultat3["Titre"] ."||". $resultat3["DescriptionLongue"] ."||</g>"; 
                    echo "<br/>";
                }
            }

        }//while
        mysqli_close($db);
        ?>
    </body>
</html>