-1
serialID(AI)|locations | telephone | address
---------------------------------------------
1           | A       
2           | B
3           | C
4           | D

users table
userID | location choosen
-------------------------
1      | A
2      | B
3      | B

如何在动态表的每一行中添加超链接?

例如(这是一个动态表)它会改变..取决于用户的喜好。

location | address | telephone | user's favourable
B        |  -      | -         |  2
A        |  -      | -         |  1
C        |  -      | -         |  0
D        |   -     | -         |  0

因此,如果我将鼠标悬停在 A 行,我可以转到另一个 php 页面并显示必要的详细信息示例,例如哪些用户选择了位置 A。有什么办法吗?请帮忙。

这是创建表代码->

<?php
include mysqli.connect.php";

   $retrieveLocation = SELECT l.locations, l.telephone, l.address, COUNT (u.userID) as userID
    FROM location AS l
    LEFT OUTER JOIN users AS u on l.locations = u.location_chosen
    GROUP BY l.locations
    ORDER BY userID DESC;

   $result = $mysqli->query($retrieveLocation);

      while ($row = $result->fetch_array(MYSQLI_ASSOC))
      { 
        echo "<tr><td>{$row['locations']}</td><td>{$row['telephone']}</td><td>{$row['addression']}</td><td>{$row['userID']}</td></tr>";
      }
?>
4

1 回答 1

0

试试这段代码在 html + php 中生成表格:

<table>
<thead>
<tr>
<th>Location</th>
<th>Address</th>
<th>Telephone</th>
</tr>
</thead>
<tbody>
<?php foreach($query as $row) { ?>
<tr>
<td><a href="your_url_page_here.php"><?php echo $row["location"]; ?></a></td>
<td><?php echo $row["address"]; ?></td>
<td><?php echo $row["telephone"]; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
于 2013-01-16T13:03:48.803 回答