一切與此代碼一起工作,但我想有一個從product.php鏈接回到類別和子類別。PHP產品頁面使類別和子類別的鏈接
我有3個父類別,page1.php,page2.php和page3.php 也爲那些我有子類別page1.php?subcat = 1,2,3,4 page2.php?subcat = 1,2 ,3,4
這是使用PHP代碼IAM到product.php
if (isset($_GET['id'])) {
$id= $_GET['id'];
$result2 = mysql_query("SELECT * FROM products WHERE id='$id' LIMIT 1");
$count = mysql_num_rows($result2);
if ($count > 0) {
while($row = mysql_fetch_array($result2)){
$pid = $row["id"];
$pname = $row["name"];
$pprice = $row["price"];
$pnoncategoryid = $row["noncategoryid"];
$pdesc = $row["desc"];
}
// gjeje emrin e categorise dhe nencategorise
$result3=mysql_query("select * from noncategory WHERE ncid=$pnoncategoryid");
while($row=mysql_fetch_array($result3)){
$noncategoryname = $row["ncname"];
$categoryid = $row["categoryid"];
}
$result4=mysql_query("select * from category WHERE cid=$categoryid");
while($row=mysql_fetch_array($result4)){
$categoryname = $row["cname"];
}
//mbaro
在類別和子類別我想有鏈接:
<h3><?php echo $pname; ?></h3>
<div class="pbr"></div>
<h4>Category:</h4>
<p class="price"><?php echo $categoryname; ?>/<?php echo $noncategoryname; ?></p>
<div class="pbr"></div>
<h4>Description:</h4>
<p class="desc"><?php echo $pdesc; ?></p>
<div class="pbr"></div>
<h4>Price:</h4>
<p class="price"><?php echo $pprice; ?> <?php echo _valuta_ ?></p>
對不起我的英文不好,希望some1明白我 :))
什麼是$ _GET [ '身份證']做,應該不會是$ _GET [ 'SUBCAT'] –
你得到通過ID的產品,它具有SUBCAT(noncat)作爲參數,並從noncat你父母(貓)對不對? – Neograph734
@BrandenStilgarSueper $ _GET ['id']用於product.php?id = 1和$ _GET ['subcat']用於category.php?subcat = 1 – RednBlack