bradgrafelman;10983506 wrote:Have you tried outputting the second SQL query to see if it looks correct? What values does the products.product_category column contain?
I tried echoing $result just now and got the query. the last part of it is product.product_category = 1 or 2 which corresponds to the ID numbers of the category_name in table product_category.
When I change the query to a join:
$select = "SELECT * FROM products, product_category WHERE products.product_category = product_category.category_name";
$result = mysql_query($select) or die(mysql_error());
It prints everything as expected. but when I change it back to:
$select = "SELECT * FROM products WHERE product_category = '$input'";
$result = mysql_query($select) or die(mysql_error());
it does nothing.
So it would seem to me that $input is not passing its info. The code for that section is this:
if (isset($_GET['categories'])) {
$input = mysql_real_escape_string($_GET['category']);
$select = "SELECT * FROM products WHERE product_category = '$input'";
$result = mysql_query($select) or die(mysql_error());
}
$GET['categories;] is the submit button and $GET['category'] is the select box holding the data from the product_category which simple consists of id and category_name