Jump to content




Recent Status Updates

  • Photo
      16 Sep
    Kadence

    Some spammers sign up to CC and then they leave their account hidden so they think it won't get noticed but with an obvious name like "SaxophoneRetailSingapore" it's hard not to know they are a spam bot. #ModLife

    Show comments (3)
  • Photo
      15 Sep
    Error

    Programming is something that I enjoy and want to make a career out of. But, I usually tend to start things and not finish them. Any advice on how I can finish what I start?

    Show comments (1)
  • Photo
      12 Sep
    FacetiousTurtle33

    Just joined. Really enjoy this sight. Excited to become a great programmer, and helper.

    Show comments (3)
View All Updates

Developed by Kemal Taskin
Photo
- - - - -

Problem with echoing variable

echo

Best Answer Ryant, 08 March 2013 - 04:42 PM

mysql_query( "SET NAMES utf8", $dbconnection );

Set Your HTTP Headers also

header( 'Content-Type: text/html; charset=UTF-8' );
Go to the full post


This topic has been archived. This means that you cannot reply to this topic.
26 replies to this topic

#25 JeanBernardValentaten

JeanBernardValentaten

    CC Newcomer

  • Member
  • PipPip
  • 15 posts

Posted 08 March 2013 - 01:38 PM

Ok, so what you need to do, is to tell the database that the client (your PHP script) wants UTF8 encoded strings. This is performed by adding the following line after having connected successfully to the database (after mysql_connect()):

mysql_query('SET NAMES utf8');

Don't forget to also set the character set header to UTF8 in your HTML document, e.g.:

<meta http-equiv="content-type" content="text/html; charset=utf-8">

Hope that helps :)



#26 Ryant

Ryant

    CC Lurker

  • New Member
  • Pip
  • 9 posts

Posted 08 March 2013 - 04:42 PM   Best Answer

mysql_query( "SET NAMES utf8", $dbconnection );

Set Your HTTP Headers also

header( 'Content-Type: text/html; charset=UTF-8' );

Edited by Ryant, 08 March 2013 - 04:47 PM.


#27 Korlando

Korlando

    CC Regular

  • Member
  • PipPipPip
  • 43 posts

Posted 09 March 2013 - 05:38 AM

Thank you very much! It works


Edited by Korlando, 09 March 2013 - 12:45 PM.