954,153 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Multilanguage with PHP-MySQL

Hi there,

I'm building a multilanguage CMS based Web site using PHP 5- MySQL and I'm facing problems with languages.

From what I've been reading I must use charset UTF-8 (as Wikipedia uses this I guess this is realy the right choice).

Now, I must also know how to store different languages in a MySQL table - possible? How do I do it?

So far I haven't succeeded storing anything different character there, not even a simple รง.

Please, any hints? I'm getting desperate here..
Thank you!

marcosjp
Light Poster
43 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

Well, 8 hours ago I posted this desperately in need of an answer. Yes, it's Sunday, but one's got to work hard if he wants to get somewhere faster... No one replied... but... I've found the solution...

Putting in simple terms:
1. Your forms must be coded in UTF-8
2. The pages where you want to display multilanguage text too.
This means you MUST use this:

3. Your MySQL table MUST be coded as utf8_general_ci

Surprisingly, this is not enough and this is what was driving me nuts...

4. So, to fix this, you must use this before issuing the sql commands:

$defineutf = "SET NAMES 'utf8";
$utf = mysql_query($defineutf);

This is the article that saved my day:
http://www.shawnolson.net/a/946/unicode-data-with-php-5-and-mysql-41.html

marcosjp
Light Poster
43 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You