I am trying to get the below code to perform an if/else
statement.
I am trying to say look in the database table 're_terms'
and if
the 'term_id' is '15'
display this code, otherwise display this code.
I realise what I have at the moment is saying $product_id
is 15
so it always displays the first set of html.
I am performing this in wordpress.
<?php
$product_id = $wpdb->get_var("SELECT term_id
FROM re_terms
WHERE name = 'contract'");
echo $product_id;
if ($product_id == '15'): ?>
<div class="grid__medium-4 grid__columns grid__columns_mobile text-c
buttons">
<a href="<?php echo get_site_url(); ?>/stockists"><span
class="button_light">Find a stockist!!!!</span></a>
<a href="<?php echo get_site_url(); ?>/brochure"><span
class="button_light">Request a brochure</span></a>
</div>
<?php else: ?>
<div class="grid__medium-4 grid__columns grid__columns_mobile text-c
buttons">
<a href="<?php echo get_site_url(); ?>/stockists"><span
class="button_light">Find a stockist</span></a>
<a href="<?php echo get_site_url(); ?>/brochure"><span
class="button_light">Request a brochure</span></a>
</div>
<?php endif ?>