I have a table that has a loan_id
and when I fetch the info, it is ok. This problem is I need to click on the loan_id
number then let it display result based on the id
number.
<?php
$data = mysql_query("select * from request, users where request.user_id = users.id and request.user_id = $user_id") or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data )) {
Print "<tr class='my_loans_tr'>";
echo ("<td id='demo' onclick='myfunction(this) class='weblex-show- detail' data-toggle='modal' data-target='#myModalw'>" .$info['loan_id'] . "</td> ");
Print " <td class='admin_amount'>".$info['amount'] . "</td> ";
Print " <td class='admin_points'>".$info['points'] . "</td> ";
Print " <td class='admin_date'>".$info['req_date'] . " </td>";
Print " <td class='admin_status'>".$info['status'] . " </td>";
Print " <td class='admin_cancelled'>".$info['cancelled_loan'] . " </td></tr>";
Print "</tr>";
}
Print "</table>";
?>
The number 146
147
are loan id's, so basically what I need is to click on the id number then it passes me the id number (any number I click) so I can then run a new query based on the loan_id
. Each loan_id
has more info stored in another table. I'm using bootstrap modal, if that matters.
I tried JavaScript but the furthest I got was to alert the same id:
<script type="text/javascript">
$(document).ready(function(){
$("#demo").click(function(){
alert("get content.");
});
});
</script>
in the end i need the value in php so i can run other MySQL query,