单击“显示”按钮时显示特定数据


show specific data when i click show button

我对如何仅显示特定详细信息有问题。 例如,假设我有两个表SalesSumarry和Rsales,并且其表有这个FF数据。

来自Rsales的数据

id | name | last_name | age | salessumarry_id |
1  |gejel | rosenthal | 21  |        5        |

数据来自SalessuMarry(注意:此数据来自数据库显示到我的网页)

id | or_no | sold_by | detail |
5  | 12456 |  fabbie | show   |
6  | 22222 |  nedy   | show   |

我的问题是这个。 当我从我的网页上单击"显示"时,它必须从 rsales 中选择数据,其中 salessumarry_id = salessumarry.id。 例如,我单击 ID 5 的显示,预期的输出必须是这样的

id | or_no | sold_by | detail |
5  | 12456 |  fabbie | show   |
id | name | last_name | age | salessumarry_id |
1  |gejel | rosenthal | 21  |        5        |
6  | 22222 |  nedy   | show   |

我把它放在我的"显示"按钮中,但我的想法只到此为止。 我不知道如何在单击显示时显示详细信息

echo '<td style="border-color:#000000; border-style:solid; border-width:1px;"><div align="center"><a  href=displaydetail.php?id=' . $row['id'] .'>show</a></div></td>';

这是完成您尝试执行的操作的基本方法:

displaydetail.php
<?php
    // get salessumarry_id  from the URL
    $salessumarry_id = $_GET['id'];
    $query = "SELECT * FROM rsales WHERE salessumarry_id = '$salessumarry_id'";
    // use mysqli/pdo here to to execute the query 
    // and fetch the results into $results array and display it here:
    echo "id | name | last_name | age | salessumarry_id |<br>";
    echo $results['id']. " | ". $results['name']." | ".$results['last_name']." | ";
    echo $results['age']." | ".$results['salessumarry_id']." | ";
?>

希望这有帮助。这可以进一步改进,但首先您需要确保这部分正在工作。