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:
<?php
$sql2= "SELECT loan_id,loan_amount,loan_totalint FROM loans WHERE
user_uid='Don mario'";
$result2 = mysqli_query($connect, $sql2);
?>
<?php
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-
dismiss="modal">×</button>
<h4 class="modal-title">Loan Info</h4>
</div>
<div class="modal-body">
<div class="container table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th width="0.01%">Id</th>
<th width="0.01%">Monto Actual</th>
<th width="0.01%">Total Interes</th>
</tr>
</thead>';
if(mysqli_num_rows($result2) > 0)
{
while($row = mysqli_fetch_array($result2))
{
echo' <tbody>
<tr>
<td>'.$row["loan_id"].'</td>
<td class="loan_amount" data-id2="'.$row["loan_id"].'"
>'.$row["loan_amount"].'</td>
<td class="loan_totalint" data-
id3="'.$row["loan_id"].'">'.$row["loan_totalint"].'</td>
</tr>
</tbody>';
}
echo '
<tr>
<td></td>
<td id="loan_amount"></td>
<td id="loan_totalint"></td>
</tr>';
}
echo '
</table>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
</div>
</div>
</div>
</div> ';