0

I am using joshcam/ PHP MySQLi class and currently having problem on inserting foreign character in the table.

I tried to update using rawQuery to identify if the problem lies with the class itself.

$db->rawQuery("UPDATE table SET fieldname=''龙岗区中心" WHERE . ..... ");

The query executes with no problem but it saves as ?????? in the table.

If i use mysql_query update on the same table , the characters insert in the table with no problem.

Has anyone experienced this? The charset is set as UTF-8.

Any help would be much appreciated.

Regards

Ash

a basnet
  • 17
  • 5

1 Answers1

0

I have now resolved this by converting the database and table to utf8 . I am answering to my own question if it helps someone.

SET character_set_results = 'utf8',character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';

ALTER DATABASE [databasename] CHARACTER SET utf8 COLLATE utf8_general_ci; ALTER TABLE [tablename] CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

a basnet
  • 17
  • 5