Just a tip though, before running an SQL query in your application dynamically, be sure it runs well with preloaded data or check it first for erros.
Let's first find if you can query this.
SELECT * FROM products WHERE category='[USER_SELECTED_CATEGORY]' ORDER BY date_added DESC LIMIT 10
Be sure that the category you put there exists in your database. And there are products assigned in your selected category. So a sample SQL command you can run with the table below:
QUERY:
SELECT * FROM products WHERE category='bags' ORDER BY date_added DESC LIMIT 10
category
|name |date_added |
-----------------------------
|bags |2012-9-12 |
|dress |2012-4-14 |
|sunglasses |2012-10-23 |
|shoes |2012-5-24 |
product
|name |category |date_added |
-----------------------------------------
|jansport |bags |2012-6-12 |
|bench |dress |2012-3-03 |
|swiss |bags |2012-9-23 |
|rayban |sunglasses |2012-6-21 |
>SELECT * FROM products WHERE category='bags' ORDER BY date_added DESC LIMIT 10;
RESULT
|name |category |date_added |
-----------------------------------------
|swiss |bags |2012-9-23 |
|jansport |bags |2012-6-12 |
Now, with your code, see my comments
/**
* This snippet has an issue on this par `ESC LIMIT 10"]", $_GE`
* you should make it like this `ESC LIMIT 10", $_GE`
* if your formatting your string you can check the one below from your code
*/
$sql = mysql_query("SELECT * FROM products WHERE category='%s' ORDER BY date_added DESC LIMIT 10"]", $_GET["selectcat"]);
// You can format it like this.
// you can even put the sprintf inside the mysql_query
// if that's your style
$formattedQuery = sprintf("
SELECT *
FROM products
WHERE
category='%s'
ORDER BY
date_added DESC
LIMIT 10
", $_GET["selectcat"]);
$sql = mysql_query($formattedQuery);