The function product()
is used on a page called products.php
. How can I make each product returned from that search (nike trainers) a clickable link to a page called product.php
and display only that products info onto the div
s on 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>";
}
}
}
Any help would be great, been struggling with this for a while now!