该函数product()
用于名为 的页面products.php
。如何使从该搜索返回的每个产品(耐克培训师)成为一个可点击的链接,指向一个名为的页面,并仅在s on 上product.php
显示该产品信息?div
product.php
/*
* This function is used for products.php page,(search page)
*/
function product ()
{
$get = mysql_query ("SELECT id, name, price, size, imgcover FROM products WHERE brand='nike'");
if (mysql_num_rows($get) == FALSE)
{ echo " There are no products to be displayed!";}
else
{ while ($get_row = mysql_fetch_assoc($get)){echo "<div id='productbox'><a href='product.php'>".$get_row['name'].'<br /> £'.$get_row['price']. ' UK'.$get_row['size']. '<br />' .$get_row['imgcover']. "</a></div>" ;}
}
}
/* The function productlayout () I am using for the product.php page and I am echoing this onto this page. */
function productlayout ()
{
$get = mysql_query ("SELECT id, name, price, size, buyfor, exfor, grade, brand, Basecolour, imgcover FROM products WHERE id ='1'");
if (mysql_num_rows($get) == FALSE)
{ echo " There are no products to be displayed!";}
else
{ while ($get_row = mysql_fetch_assoc($get))
{ echo "<div id='layouttitle'>".$get_row['name']."</div>
<br /> <div id='layoutprice'>£".$get_row['price']. "</div>
<div id='layoutsize'>UK".$get_row['size']. "</div>
<br /><div id='layoutgrade'>Condition " .$get_row['grade']. "</div>
<div id='layoutbrand'>" .$get_row['brand']. "</div>
<div id='layoutbcolour'>Base Colour - " .$get_row['Basecolour']. "</div>
<div id='givecash'>" .$get_row['buyfor']. "</div>
<div id='giveexchange'>" .$get_row['exfor']. "</div>";
}
}
}
任何帮助都会很棒,现在已经为此苦苦挣扎了一段时间!