Jump to content

Define exchange rate and multiple value to data


kevin66

Recommended Posts

Hi, am trying without much luck, (I am new), to define an exchange rate on the page and then mutiplying it by a value I am extracting from a mysql db.

 

I write the value as below normally but having trouble writing this entry and multiplying it by my defined exchanged rate of say 2.22.

 

<?php

if(!empty($row['Band_1_Price']))  {echo "<div class=pricing_box_right2>£".$row['Band_1_Price']."</div></div>"; }

?>

 

Thanks so much.

Link to comment
Share on other sites

Exactly, but when I use it like -

 

if(!empty($row['Band_1_Price']))  {echo "<div class=pricing_box_right2>£".$row['Band_1_Price']*2.22."</div></div>"; }

 

it gives an error I think the prob is when I add the </div>

 

Can I define it first and then use when i write as I need to write it in 6 places

Link to comment
Share on other sites

I got it working like you said but it doesnt write 2 decimal places , how can i force it to do this?

 

<?php

if(!empty($row['Band_3_Price']))  {echo "<div class=pricing_box_right2>£".$row['Band_3_Price']*0.4."</div></div>"; }

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.