Jump to content

Query not working for several sub-categories


son

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...