We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Issue with variable not showing in query tag output inside an entry tag

How Do I?

From EE Slack's avatar
From EE Slack
185 posts
2 years ago
From EE Slack's avatar From EE Slack

re: nesting a query inside a channel entries tag issue:

Any thoughts? Stuck on this one for awhile…

{!-- First {entry_id} --}
{exp:query sql="SELECT start_date FROM exp_calendar_events WHERE entry_id = '{entry_id}'"}
  {!-- Second {entry_id} --}
  {start_date}
{/exp:query}

When uncommenting the “first” entry_id I get a nice list. When uncommenting the “second” entry_id I get a nice list. I’ve never received the {start_date}, even when explicitly providing a entry_id. I have ran the query through the back-end to verify and get the data.

       
From EE Slack's avatar
From EE Slack
185 posts
2 years ago
From EE Slack's avatar From EE Slack

Solution- if you change it from

Select start_date FROM

to

SELECT start_date as starter_date_test FROM

and then use starter_date_test as a variable does it work?

It does indeed work, because start_date was conflicting with an entry variable. Giving it an alias prevented it being overwritten- something to keep in mind whenever nesting tags!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.