显示单个记录的链接

时间:2015-06-15 09:21:23

标签: php html sql

如何在点击名称" Alex"时显示单个记录。

 <?php
    echo "<table class='tableSection' border='1'><thead><tr><th><span class='tb_row2'>Referee</span></th><th><span class='tb_row2'>Date Referred</span></th><th><span class='tb_row2'>Status</span></th><th><span class='tb_row2'>Date Approved</span></th></tr></thead>";
    $printlist_sql = "select a.Name, a.todate from table1 a left join admin_login b on a.StaffID = b.User_Id where b.Admin_Id ='userID' order by table_Id";     

    echo "<tbody>";
            $referral_result = mysql_query($printlist_sql, $link);
                                     while ($s_referral_row = mysql_fetch_array($referral_result))
                                     {                                       
                                        echo "<tr><td class='tb_row2'>".$s_referral_row['Name']."</td>";
                                        echo "<td class='tb_row2'>".$s_referral_row['todate']."</td>";                                      
                                     }

       echo " </tbody>";
    echo "</table>";
    ?>

我的表:

Name   Todate
Alex   2015-05-22
Alice  2015-05-22

1 个答案:

答案 0 :(得分:1)

 <?php
    echo "<table class='tableSection' border='1'><thead><tr><th><span class='tb_row2'>Referee</span></th><th><span class='tb_row2'>Date Referred</span></th><th><span class='tb_row2'>Status</span></th><th><span class='tb_row2'>Date Approved</span></th></tr></thead>";
    $printlist_sql = "select a.Name, a.todate from table1 a left join admin_login b on a.StaffID = b.User_Id where b.Admin_Id ='userID' order by table_Id";     

    echo "<tbody>";
            $referral_result = mysql_query($printlist_sql, $link);
                                     while ($s_referral_row = mysql_fetch_array($referral_result))
                                     {                                       
                                        echo "<tr><td class='tb_row2'><a href="test.php">".$s_referral_row['Name']."</a></td>";
                                        echo "<td class='tb_row2'>".$s_referral_row['todate']."</td>";                                      
                                     }

       echo " </tbody>";
    echo "</table>";
    ?>