0

我正在从 MySQL 查询创建一个 PHP 表,如下所示:

    $resultkulim = mysql_query("SELECT customer_name, zone_name, segment_code, COUNT(segment_code) FROM complete_wk where zone_name = 'ZONE KULIM' and (segment_code = 's30' or segment_code='s40' or segment_code='s50'')");
    $totalrrkulim = mysql_query("SELECT zone_name, repeat_rc, COUNT(repeat_rc) FROM complete_wk where zone_name = 'ZONE KULIM' and repeat_rc>1 and (segment_code = 's30' or segment_code='s40' or segment_code='s50')");

                echo "<table class='table1'>";
                echo "<thead>";
                    echo "<tr>";
                        echo "<th>Zone</th>";
                        echo "<th>Total TR</th>";
                        echo "<th>Total RR (RR>1)</th>";
                        echo "<th>%RR</th>";
                    echo "</tr>";
                echo "</thead>";
                //kulim row
                while($rowkulim = mysql_fetch_array($resultkulim))
                  {
                        echo "<tbody>";
                        echo "<tr>";
                            echo "<td>Zone Kulim</td>";
                            echo "<td >" . $rowkulim['COUNT(segment_code)'] . "</td>";
                      while($rrkulim = mysql_fetch_array($totalrrkulim))
                          {
                            $myresultkulim = $rrkulim['COUNT(repeat_rc)'] / $rowkulim['COUNT(segment_code)'] * 100;
                                  echo "<td>" . $rrkulim['COUNT(repeat_rc)'] . "</td>";
                                  echo "<td>" . number_format($myresultkulim) . "%" . "</td>";
                              echo "</tr>"; 
                            echo "</tbody>";
                          }
                  }
                echo "</table>";

该表的示例结果如下:

Zone         Total TR    Total RR    %RR
Zone Kulim     182          11        6%  

我想要做的是,我希望能够单击 Total TR 的结果,即“182”,它会将我带到包含该 182 结果详细信息表的其他页面。

我已经完成了另一张表,它位于“localhost/tmj/index.php/tr/kulim”

我希望有人能启发我如何从上面的表格代码中制作弹出窗口或超链接到其他页面。

4

1 回答 1

0

我不确定这是否是您想要的,请尝试

echo '<td ><a href="index.php/tr/kulim">' . $rowkulim['COUNT(segment_code)'] . "</a></td>";

或者这是一个动态链接?

于 2012-04-16T02:14:23.457 回答