I have a fairly complicated sequence of queries that I need run in order as later queries rely on results from a previous query and I'm using PHP to help refine and save data. I need to pass in a PHP value into two of my EE queries but I can't get a result and I'm presuming it's a parse order issue. Can anyone advise me on how to fix this? I need to make the "category" parameter in the 2nd EE query dynamic, its currently hardcoded as 51.
{!-- get category for approved skill --}
{exp:channel:entries
channel="skills"
status="open"
entry_id="{segment_2}"
limit="1"
dynamic="no"
disable="member_data|pagination"
}
{categories}
<?php $cats[] = "{category_id}"; ?>
{/categories}
<?php $cat = end($cats);?>
{/exp:channel:entries}
{!-- get total number of skills belonging to category --}
{exp:channel:entries
channel="skills"
status="open"
category="51"
dynamic="no"
disable="member_data|pagination"
}
<?php $skill_count = "{total_results}";?>
{/exp:channel:entries}