/    Sign up×
Community /Pin to ProfileBookmark

php/mysql communication

Hi:

I’ve been having problems making php and mysql communicate with each other for a while. The problem specifically is characters that keep appearing because the character encodings are different.

can anyone tell me the exact steps i need to take to ensure this doesn’t keep happening. for example heres what i have:

  • 1.

    the encoding on the db seems to be: 65001 (UTF-8)

  • 2.

    My Webpages are using the utf-8 charset.

    [code]
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
    [/code]

  • 3.

    After connecting to my db I set:

    [code=php]
    $this->query(“SET NAMES ‘utf8′”, $this->conn);
    $this->query(“SET CHARACTER SET ‘utf8′”, $this->conn);
    [/code]

  • 4.

    set my tables and fields to all use utf-8 encodings

  • I thought this would pretty much catch everything, however, when i:

    [code=php]
    echo mysql_client_encoding($this->conn) ;
    [/code]

    i get: latin1

    can anyone point me in the right direction to get my apps and db communicating correctly. Any webpages (i’ve looked) or any info is appreciated.

    Thanks guys

    to post a comment
    PHP

    0Be the first to comment 😎

    ×

    Success!

    Help @Sid3335 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.22,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...