Jump to content

php mysql help with currency convert


UnknownPlayer

Recommended Posts

Hi,

i have 2 currencies in my mysql and when user add new article, he choose currency and price.

Now i need search engine for searching articles, and i have problem in part when user choose to show only articles between 100 and 200 euros, so i need help to convert all currencies to euro(all in mysql query) and show from 100 to 200 dollars, so if article price is 100 euros, then to show it too.

Can someone help me ?

1 euro = 0.70 $ (example for values)

Link to comment
https://forums.phpfreaks.com/topic/249188-php-mysql-help-with-currency-convert/
Share on other sites

You have 2 currencies in your MySQL? You should really only have one standard. For instance either USD or EURO.  Then it only takes a simple multiplication operation to convert to another currency on the fly. You now have the job of find the rates relative to your standard.

 

These rates should be stored in a separate table.

Rates
--USD -2.00
--XCD -500
....

 

You can then select the appropriate rate and then multiply the corresponding value to make the conversion.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.