Hey,
I am wanting to make a script that will create a dropdown menu with different types of items (Shoes, Socks, Pants, ...) and how many items there are of that type (125, 44, 56, ...). I'm wondering if there is a way to check a mysql field for different several entries. Currently, I am using many queries like:
$sql1 = "SELECT * FROM items WHERE clothing='Shoes'";
$result1 = mysql_query($sql1) or die ("Couldn't get results.");
$num1 = mysql_num_rows($result1);
$sql2 = "SELECT * FROM items WHERE clothing='Socks'";
$result2 = mysql_query($sql2) or die ("Couldn't get results.");
$num2 = mysql_num_rows($result2);
$sql3 = "SELECT * FROM items WHERE clothing='Pants'";
$result3 = mysql_query($sql3) or die ("Couldn't get results.");
$num3 = mysql_num_rows($result3);
Is there a way to get all that done with one query? Is there a way to tell when the mysql field changes and then use a function? Thanks.