H, i'm sorry if this is the wrong forum section, I wasn't sure which would be more appropriate since i'm fairly new to PHP still.
On the index.php page, I have links that say:
Playstation 3
Xbox 360
And when a user clicks those links, I want them to go to the product_display.php page, and display everything from the database with the subcategory "playstation3" or "xbox360", with about a limit of 10 per page.
My database is called products, and subcategory is where each item is labelled as playstation3 or xbox360.
I'm currently using this code to display products on the main page, but I can't limit it by category based on a link click.
$dynamicList="";
$sql = mysql_query("SELECT * FROM products ORDER BY release_date DESC LIMIT 4");
$productCount = mysql_num_rows($sql); //count the output amount
if ($productCount > 0) {
while ($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$subcategory = $row["subcategory"];
$price = $row["price"];
$release_date = strftime("%b %d, %Y", strtotime($row["release_date"]));
//$dynamicList .= "$product_name - $subcategory<br />released on: $release_date<br />$price";
$dynamicList .= '<div id="gamebox">
<div id="gameimage"><a href="product.php?id=' . $id . '"><img src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="98" height="140" border="0" /></a></div>
<p><b>' . $product_name . ' - ' . $subcategory . '</b></p>
<p>Released: ' . $release_date . '</p>
<br />
<br />
<p>$ ' . $price . '</p>
<p><a href="product.php?id=' . $id . '">View Product</a></p>
</div>';
}
} else {
$product_list = "You have no products listed in your store yet";
}
mysql_close();
}
Any help would be greatly appreciated, thanks.