sonam
sonam

Reputation: 3760

How to store currency symbols in a MySQL database?

I want to store all the countries and currencies used in all countries. For that I created tables as:

 ______________________________________
|countries                             |
|--------------------------------------| 
|id pk, ai                             |
|currency_id fk references 'currencies'|
|country                               |

 ____________
|currencies  |
|------------|
|id pk,ai    |
|currency    |
|code        |
|symbol      |

In the currency table, I am storing the currency symbol like $ for dollar. I am inserting value from PHPMyAdmin 3.4.5. It goes well for symbols like $, €. But when I insert the symbol for Afghanistan or Macedonia, the values inserted are displayed like ??? in the symbol column. How can I fix this? Please suggest the ways to do it. Should I store the actual character or other techniques?

Upvotes: 0

Views: 5590

Answers (2)

M Khalid Junaid
M Khalid Junaid

Reputation: 64476

you have to check the collations and character sets for your table and as well as database too they must match and for your problem you have to use utf8_general_ci help

Upvotes: 2

RuntimeException
RuntimeException

Reputation: 1643

I am just guessing that you might have created the table with default character set. Table should have the charset UTF 8.

Also, is it possible that values are inserted correctly, but not shown correctly by phpmyadmin ? (I have never used phpmyadmin)

Upvotes: 0

Related Questions