This should work just fine - what error do you get? Try print $category to see what the actual query looks like.