How to display discount percentage if discount percentage is greater than zero? PHP -


i have php script selling deals. currently, there 2 requirements deal; 1 deal_value (original price) , special_value (discount price). have variables: deal_value, special_value, deal_percentage (which coded discount percentage). these inserted database already.

so how show discount percentage label if deal percentage > 0%?

fyi: have php html hot label already, how code , display hot_label if deal percentage > 0%?

also, need echo whole div= hot_label, there php inside , because there css in class=hot_label

 <div class="hot_label">       <p>off</p>       <b><?php echo round($h->deal_percentage); ?>%</b>  </div> 

<?php if ( $h->deal_percentage > 0) {     echo '<div class="hot_label"><p>off</p><b>' . round($h->deal_percentage) . '%</b></div>'; } ?> 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -