No, there is no guarantee that there exists a syntactical error with the SQL statement. This alone could be a problem here though:
'$subcategory' as it stands out given that its populated from an 'id' could possibly be an integer. MySQL can be configured to strict datatyping.
Given the check on the mysql_query function doesn't produce an error report with the mysql_error indicates to me its not syntactical. My take on the description is that it works when manually entered (presumably using a query directly on the client or with something like PHPMyAdmin).
Based on what I see here and what the described output is, my first suggestion is to open your error reporting up:
PHP Code:
ini_set('display_errors', 1);
error_reporting(E_ALL);
or check your error logs. Any issue indicating a connection failure with the database? Mysql_error when there is no possible error should produce an empty string.
If not, post more code. This isn't by itself (we can see a syntactical fault with a missing end brace if it were by itself), so we cannot tell looking at this that its even possible to reach this branch statement.