[英]show specific data when i click show button
i have problem on how to display specific details only. 我对仅显示特定详细信息有疑问。 let say for example i have two table salessumarry and rsales and have this ff data for its table. 比方说,例如,我有两个表salessumarry和rsales,并且其表具有该ff数据。
data from rsales 来自销售的数据
id | name | last_name | age | salessumarry_id |
1 |gejel | rosenthal | 21 | 5 |
data from salessumarry (note: this data is from database display to my webpage) 来自salessumarry的数据(注意:此数据从数据库显示到我的网页)
id | or_no | sold_by | detail |
5 | 12456 | fabbie | show |
6 | 22222 | nedy | show |
my problem is this. 我的问题是这个。 when i click "show" from my webpage it must select data from rsales where salessumarry_id = salessumarry.id. 当我从网页上单击“显示”时,它必须从rsales中选择数据,其中salessumarry_id = salessumarry.id。 let say for example i click show for id 5 the expected output must be something like this 假设例如,我单击显示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 |
i put this in my "show" button but my idea is up to only this point. 我将其放在“显示”按钮中,但我的想法只有到此为止。 i don't have idea how to display details when i click 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>';
This is a basic way to accomplish what you are trying to do: 这是完成您要执行的操作的基本方法:
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']." | ";
?>
Hope this helps. 希望这可以帮助。 This can be further improved but first you need to make sure that this part is working. 可以进一步改进它,但是首先您需要确保该部分正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.