0

this is my expression engine query

$query =  $this->EE->db->query("SELECT * FROM exp_categories WHERE parent_id=$parent_id order by cat_id ASC");


and $parent id = 4|7 (for category parent id passed from template by user)

now query should return result for both parent id's

1
  • 4
    This question appears to be off-topic because it is about writing SQL queries – Jeremy Gimbel May 13 '14 at 12:36
5

Isn't this really an SQL or PHP question?

I think you'd need to split the pipe delimited data up (say by using explode() to create an array) and then loop through it outputting a fragment of SQL each time and build your query up.

SQL syntax would be (not the full query);

 WHERE parent_id = 4 OR parent_id = 7 ORDER BY

Or:

WHERE parent_id IN (4,7)
1
  • Robson's edit is the simpler way to do it, just replace the pipes with commas and you're good to go! – foamcow May 13 '14 at 14:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.