在模态PHP,Javascript中显示基于userId的循环数据

This picture shows the list of instructors from my database. Whenever the user clicks on the instructor's images.

List of instructors

A modal will appear and will display the broad details about the instructor.The modal displays the name, bio, descriptions and playlist. I'm having a problem when fetching the details about their favorite playlist.

In my database i have the table of playlist(tb: ch_music) where all of the registered favorite playlist of the instructor will be save there.

My conclusion in here is to get the unique id of the instructor and do the query for playlist inside the modal but i dont know how to do that.

Here's my code for fetching the instructor's list(instructor.php) Whole codes not shown just the important part only

<?php
$instructor_fetch = mysqli_query($link,"SELECT * FROM ch_users AS U LEFT JOIN ch_socialmedia as SM ON U.userId = SM.userId LEFT JOIN ch_music as M ON M.userIdM = U.userId GROUP BY U.userId ORDER BY COUNT(U.userId) DESC");
while($instructor_row=mysqli_fetch_array($instructor_fetch)){
?>
<span id="desc<?php echo $instructor_row['userId']; ?>"><?php echo $instructor_row['description']; ?></span>
<span id="bio<?php echo $instructor_row['userId']; ?>"><?php echo $instructor_row['bio']; ?></span>

<img class="instructorpic" id="imageresource<?php echo $instructor_row['userId']; ?>" src="img/instructor/<?php echo $instructor_row['profile']; ?>">
<?php
}
?>

and here's my modalcustom.js(this js performs the passing of data into modal)

$(document).ready(function(){
$(document).on('click', '.edit', function(){

    var id=$(this).val();
    var insModal = $('#instructorname'+id).html();
    var descModal = $('#desc'+id).html();
    var bioModal = $('#bio'+id).html(); 


    $('#imagepreview').attr('src', $('#imageresource'+id).attr('src'));
    $('#eIns').html(insModal);
    $('#eDesc').html(descModal);
    $('#eBio').html(bioModal);
    $('#edit').modal('show');
});
});

and here's my codes for the modal(shown the whole codes) i'm not using data-id this code is from (modal.php) i used include script to my instructor.php

 <div class="modal fade bd-example-modal-lg" id="edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <br>

            </div>
            <div class="modal-body">
            <div class="container-fluid">

             <div class="containermodal flex-direction">
                  <div class="col-md-5">
                        <img src="" id="imagepreview" class="instructorpic imageModal">
                  </div>
                  <div class="col-md-6">

                        <h1 id="eIns"></h1>
                        <span style="color:#ffde03;">CYCLEHOUSE HEAD COACH</span><BR>
                        "<span id="eBio"></span>"
                        <BR><BR>
                        <p id="eDesc"></p>
                        <BR>
                        <button class="cycle-button">BOOK NOW</button>
                        <br><br>
                        <span style="color:#ffde03;">LISTEN TO MY SPOTIFY PLAYLIST:</span><BR><BR>

                        <?php
                        $instructor_music = mysqli_query($link,"SELECT * FROM ch_music WHERE userIdM = '$idkhowtodo'");
                        while($music_row=mysqli_fetch_array($instructor_music)){
                        ?>
                        <div class="col-xs-6 col-sm-4">
                            <img src="img/playlist/<?php echo $music_row['music_img']; ?>" style="height:100px; width:100px;">
                        </div>
                        <?php
                        }
                        ?>
                        <!--</div>-->
                  </div>
              </div>


            </div>
            </div>
            <div class="modal-footer">
               <br>
            </div>
        </div>
    </div>
</div>

What i am trying to do is to allocate the unique id of the instructors to the modal($idkhowtodo) so that the query statement will run properly.