开发者

How can I make my DB connection UTF8 enabled

开发者 https://www.devze.com 2023-02-20 16:59 出处:网络
I have a DB which I\'ve filled using PHPMyAdmin with German paragraphs, and when I try to r开发者_如何转开发etrieve data from DB I only get ?? .. so how can I make sure that the connection to DB is UT

I have a DB which I've filled using PHPMyAdmin with German paragraphs, and when I try to r开发者_如何转开发etrieve data from DB I only get ?? .. so how can I make sure that the connection to DB is UTF8 enabled?


mysql_set_charset

"Sets the default character set for the current connection."

mysql_client_encoding

"Retrieves the character_set variable from MySQL."

<?php
$link    = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$charset = mysql_client_encoding($link);

echo "The current character set is: $charset\n";
?>
0

精彩评论

暂无评论...
验证码 换一张
取 消