我想要做的是顯示我目前在我的Puchase表中顯示的所有購買信息。我想它,所以它會顯示其確實購買項目,但是,我想使它看起來像這樣:如何在sub php頁面顯示信息?info = ID php page
採購項目1
點擊更多信息鏈接到信息= ID,並顯示剩餘信息
這是代碼我目前有:
<?php
$sql="SELECT PurchaseID, FrameNumber, Date From Purchase WHERE Email = '$id'";
$purchases = mysqli_query($con, $sql);
while(list($purchaseid, $framenumber, $date) = mysqli_fetch_row($purchases)){
echo "
<table width=\"100%\">
<tr>
<th>PurchaseID:</th>
<th>Date Of Purchase:</th>
<th>FrameNumber:</th>
<th>More Details</th>
</tr>
<tr>
<td>$purchaseid</td>
<td>$date</td>
<td>$framenumber</td>
<td><a href=\"myaccount.php?info=$framenumber\">Click Here</a></td>
</tr>
</table>";
$info = $_GET['info'];
if($info){
$fnumber = mysqli_query($con, "SELECT BikeCode FROM BikeStock WHERE FrameNumber = '$info'");
while(list($bikecodes) = mysqli_fetch_row($fnumber)){
$bikes = mysqli_query($con, "SELECT * From Bike WHERE BikeCode = '$bikecodes' LIMIT 1");
while(list($bikecode, $manufacturer, $model, $subtype, $year, $fmaterial, $desc, $gender, $type, $price, $stock) = mysqli_fetch_row($bikes)) {
echo "<table><tr><th>BikeCode:</th>
<th>Manufacturer:</th>
<th>Model:</th>
<th>FrameMaterial:</th>
<th>Year:</th>
</tr>
<tr>
<td>$bikecode</td>
<td>$manufacturer</td>
<td>$model</td>
<td>$fmaterial</td>
<td>$year</td>
</tr>
<tr><th>Description:</th><td colspan=\"4\">$desc</td></tr>
<tr><th>Bike Images:</th><td colspan=\"4\">
<div id=\"gallery\">";
$sql = "SELECT SourcePath, Description FROM BikeImages where bikecode = '$bikecode'";
$result = mysqli_query($con, $sql) or die('Query2 failed: ' . mysqli_error($con));
while(list($sourcepath, $description) = mysqli_fetch_row($result)) {
echo "<a class=\"gallery\" href=\"$sourcepath\" title=\"$description\"><img src=\"$sourcepath\" width=\"72\" height=\"72\" /></a>";
}
echo "</div></td></tr></table>";
}
}
}
}
?>
編輯: 我目前遇到的問題是,當我點擊詳細信息則顯示所有三個項目的所有信息,而不是隻有一個。我有限的SQL只抓住一個產品,但是,它只是重複其他購買ID產品,即使它不是正確的產品。
我的電流輸出是這樣的:
採購項目1:
信息顯示
採購項目2:
信息顯示,即使我不希望它顯示我只需要購買第1項信息即可顯示。
,什麼是錯誤? – jcho360
你可以把你當前的輸出放在這裏嗎?很難理解你想要的 –
我已經對帖子進行了編輯,對此很抱歉。 – Hii