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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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