If $cat_id contains "" then the query will fail with a syntax error.
But we don't know what's in it, nor do we know what's in your table - and we certainly have no idea what "don't work" means unless you tell us.
Check if your query gave an error message.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.