Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7857163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:57:10+00:00 2026-06-02T20:57:10+00:00

my table char set is utf8 and it’s collation is utf8.now i have this

  • 0

my table char set is utf8 and it’s collation is utf8.now i have this code:

   $mysqli = new mysqli("localhost", "root", "", "Amoozeshgah");

            if (mysqli_connect_errno()) {
                  printf("Connect failed: %s\n", mysqli_connect_error());

            }
          if (!$mysqli->set_charset("utf8")) {
    printf("Error loading character set utf8: %s\n", $mysqli->error);
} else {
    printf("Current character set: %s\n", $mysqli->character_set_name());
}
        mysql_set_charset('utf8');
            if ($stmt = $mysqli->prepare("SELECT About_Title FROM Tbl_About WHERE About_Id=?")) {
                $city = 8;

               /* bind parameters for markers */
                $stmt->bind_param("s", $city);

              /* execute query */
                $stmt->execute();

               /* bind result variables */

                  $result = $stmt->get_result();

             /* fetch value */
            while ($myrow = $result->fetch_assoc()) {

        // use your $myrow array as you would with any other fetch
        printf("%s is in district %s\n", $city, $myrow['About_Title']);
        print("shod");

    }

but out put is:

Current character set: utf8 8 is in district نتمنتشس shod

what can i do?
Edit:
i replaced:

if (!$mysqli->set_charset("utf8")) {
        printf("Error loading character set utf8: %s\n", $mysqli->error);
    } else {
        printf("Current character set: %s\n", $mysqli->character_set_name());
    }
            mysql_set_charset('utf8');

with

$mysqli->set_charset("utf8")

but no difference.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:57:12+00:00Added an answer on June 2, 2026 at 8:57 pm

    Please replace mysql_set_charset('utf8'); to $mysqli->set_charset("utf8") 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table: create table test ( fname char(20) character set utf8
I have an InnoDB table in mysql with utf8 charset and utf8_general_ci collation. After
I have a table 'ABC' (charset = utf8) and these are my character set
This works UTF8 create temporary table test (x char(1) not null) charset=utf8; insert into
I already have done this: mysql_set_charset(utf8,$link); at the connection mysql_query(SET NAMES 'UTF8'); at the
I use SQL Server 2008 and have a table with 5 char typed columns.
My table looks like this- province_id int(11) province_title char(200) utf8_general_ci parent int(8) int(2) I
I have a table with 5 million records of dates stored as char(10) with
I have a table which has a column called Direct of type char(1). It's
I have a table called sales with the following few columns: salesno (PK, char(25))

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.