Modal Window, Get Row Value, Bootstrap Table


I have a question.

I have a table in which I show the ones of a client, of a table called Clients with fields: user_first, user_last, user_uid ...

Then I have a button with the symbol '#' that when pressed shows me a modal window with values of another table that have a relationship with this client, the other table is called FERTILIZERS.

Each client has that '#' button to show that data in the modal window.

How do I press it to detect the value of the row I press or the username ??

Currently I did it rude: "SELECT loan_id,loan_amount,loan_totalint FROM loans WHERE user_uid='Don mario'";

But how do I know how many users or names they will have as I do to identify the row?

Please help me?

my code is as follows:

       $sql2= "SELECT loan_id,loan_amount,loan_totalint FROM loans WHERE 
       user_uid='Don mario'";

       $result2 = mysqli_query($connect, $sql2);



        echo '

               <!-- Modal -->
               <div id="myModal" class="modal fade" role="dialog">
               <div class="modal-dialog modal-lg">

               <!-- Modal content-->
               <div class="modal-content">
               <div class="modal-header">
               <button type="button" class="close" data- 
               <h4 class="modal-title">Loan Info</h4>
               <div class="modal-body">

               <div class="container table-responsive">

               <table class="table table-hover">
                 <th width="0.01%">Id</th>   
                 <th width="0.01%">Monto Actual</th>
                 <th width="0.01%">Total Interes</th>    


               if(mysqli_num_rows($result2) > 0)  
               while($row = mysqli_fetch_array($result2))  
               echo' <tbody>


              <td class="loan_amount" data-id2="'.$row["loan_id"].'" 

              <td class="loan_totalint" data- 


              echo '

            <td id="loan_amount"></td>
            <td id="loan_totalint"></td>  



           echo '     


             <div class="modal-footer">
             <button type="button" class="btn btn-default" data- 

             </div>  ';
asked by Nor 14.11.2018 в 04:53

1 answer


You can create a method that shows the data of the user you want, then to execute the function according to the user, you create a button that executes that method and inside you send the user's parameters, In javaScript it would be something more or less like that when you run the function, it will know which user it is and so load the data and show them, try to use that with PHP

answered by 14.11.2018 в 05:18