我有一個PHP頁面,其產品列表如下所示。最後一列是鏈接到單個產品頁面的鏈接,報告有關該產品的所有詳細信息。Mysql/Php - 顯示從列表中選擇的單個產品頁面
ID | Title | LINKTOPAGE
-------|--------------|------------------
001 | ProductTitle | $ID(001)-->Link to the single_product_page.php
002 | ProductTitle | $ID(002)-->Link to the single_product_page.php
003 | ProductTitle | $ID(003)-->Link to the single_product_page.php
上表是由下面的循環產生:
<?php
while ($row = mysqli_fetch_array($risultato)){
echo '<tr>
<td>'.$row['id'].'</td>
<td>'.$row['post_title'].'</td>
<td>'.'LinkToSinglePage >>'.'</td>
</tr>';
}?>
我已經準備從該查詢檢索數據的單頁:
SELECT
p.id as ID,
p.post_title,
p.post_status,
p.post_excerpt as shortdesc,
p.post_content as longdesc
FROM mg_posts as p
WHERE p.ID= 13323
GROUP BY p.ID
什麼我想是否將「linktoProductPaGe」鏈接到單個頁面。如果我沒有錯,我應該用存儲所選產品的ID的變量替換ID = 13323。
任何建議如何?
是你需要更換 –
用事先準備好的聲明中,還可以使用較後ID的變量。 –
Tim,我想念的是如何將products_lists.php的變量(ID產品)傳遞給single_product_page.php的p.ID,如示例'13323'中所示。 – Alex