如何从php中的mysql fetch获取变量值并使用它来创建另一个查询

时间:2016-12-30 22:28:37

标签: php jquery mysql

这是我输出的代码

 <?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'>"; 
     print "<td  class='detail'>"  .$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>";
?>

输出

enter image description here

loan id位于数据库中,还有一个名为collected的第二个表,其中包含每个loan id的信息(基于相同loan id的最少3行信息)

如何从查询中获取每个id,单击它,获取当前id并将其声明为值,以便我可以执行另一个查询,

select * from collected where loan id = "$loan_id clicked";

我搜索了javascriptjquery,但我无法使用post method,这是最好的方法吗?

0 个答案:

没有答案