Hey all,
I’m trying to run a query using the {exp:query} module, but I’m running into an issue. I want to use the {member_id} in the query, but for some weird reason it’s not actually replacing the {member_id} within the query. It works inside the {exp:query} tags normally, so I’m a bit lost…
Sample code to try:
<h1>{member_id}</h1>
{exp:query sql="SELECT c.cat_id FROM exp_categories c, exp_category_field_data f WHERE c.cat_id = f.cat_id AND f.field_id_12 = '{member_id}' AND cat_url_title = '{segment_4}' LIMIT 1"}
<h2>Query 1: {member_id}</h2>
<p>{/exp:query}</p>
<p>{exp:query sql="SELECT * FROM exp_categories LIMIT 1"}</p><h2>Query 2: {member_id}</h2>
<p>{/exp:query}Actual output from SQL debugging (Query 1):
SELECT c.cat_id FROM exp_categories c, exp_category_field_data f WHERE c.cat_id = f.cat_id AND f.field_id_12 = '{member_id}' AND cat_url_title = 'test' LIMIT 1Note that the {member_id} is left without replacement…
Mod Edit: Moved to the Technical Support forum.