Jump to content

UTF-8 help in using mySQL and PHP


newageguy

Recommended Posts

Hi,

 

Encountering some problems when trying to store and display UTF-8 on my website. I can see the data correctly in phpMyAdmin but when I try to display on my website, the data became ????.

 

Am wondering what is wrong with my codes or settings. I am hosting my website with hostgator and changing my.cnf seems impossible ( i maybe wrong ).

 

mysql_connect( DB_HOST, DB_USER, DB_PASS );
@mysql_select_db( DB_NAME ) or die( "Unable to select database");

mysql_query("SET NAMES 'utf8'");
$query	= "SQL Select here";

$return = undef;
$result	= mysql_query($query);

if ($info = @mysql_fetch_array( $result )) {
	$return =  $info;
}

@mysql_free_result ( $result );	
mysql_close();

return $return;

 

Note when I try to print the mysql_client_encoding(), the result is latin1. Do let me know if i need to attach any more results here.

 

Any help is greatly appreciated!!

 

 

Link to comment
https://forums.phpfreaks.com/topic/111309-utf-8-help-in-using-mysql-and-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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