I’m just trying to query one entry in the database to pull two custom date fields and create a simple PHP variable that I can use for conditionals throughout the page. Here’s what I currently have:
{exp:query sql="SELECT field_id_452, field_id_453 FROM exp_channel_data WHERE entry_id = '77342'"}
{if current_time >= field_id_452 AND current_time <= field_id_453}
<?php $customVariable = 'y'; ?>
{/if}
{/exp:query}But this doesn’t work. $customVariable always outputs as “y”. I’m assuming it’s a parsing order issue (I have to use Output) because if I take out the PHP and just show/hide the “y” with EE—it works.
What’s the quickest/simplest way to run the query and generate the variable? I tried to use the database class—but struggled with syntax.
Any help you can provide would be greatly appreciated. Thank you.