Jump to content

Query not working for several sub-categories


son
 Share

Recommended Posts

I get data from db that holds info about category parents and sub-categories as

$galleryCheckQuery = "SELECT imgID FROM table1 WHERE catID = $catID OR catID = (SELECT catID FROM table1 WHERE parent = $catID)";

Now I have the issue that this is not working when there are several sub-categories... What would be a good solution to this? Son

Link to comment
Share on other sites

Got the answer! Gosh, recently my brain has really gone for a walk... The following does the trick:

$galleryCheckQuery = "SELECT imgID FROM table1 WHERE catID = $catID OR catID IN (SELECT catID FROM table1 WHERE parent = $catID)";

Son

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...