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

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.