Reputation: 89
I have a problem with encoding.
A friend gave me his php/mysql project to check out. (db, tables, src -> utf8)
I have created and imported his stuff as utf8. Everything was fine until I added a new table to database. Then while encoding php<->mysql crushed, also things I didn't touch.(phpmyadmin still display good values, browser still utf8)
The solution was adding to my.ini file the following lines:
character-set-server=utf8
collation-server=utf8_general_ci
My friend made the same changes on his system, but we made a little test and another friend did the same as I had (adding a table) and it was fine without modifying .ini file.
My question is where potentially could the problem be?
It's important to me because some other friends want the same changes and I'd like to implement this without having them all alter their my.ini files.
Upvotes: 2
Views: 184
Reputation: 556
Try this function in connection
mysql_query("SET CHARACTER SET utf8");
or
<?php
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
mysql_query("SET character_set_results=utf8");
?>
Upvotes: 3