0

I have a confusing problem with php and css.

I created a database in phpmyadmin. All fields collation is utf8_general_ci. Also my table and database use the same collation as the fields. I tried every way to store data in database like using VALUES (N'content').

the most confusing problem is when I insert data using php my admin it shows at the webpage with question marks. When I store with PHP with the same SQL code it shows fine at the webpage but in the database strings shows like this:

تست ÙØ§Ø±Ø³ÛŒ

I really tried everything, can anyone help me through this problem?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

0

utf8_general_ci isn't a character set, it's a collation. The collation determines how MySQL will decide how to order things when you ask it to sort alphabetically, it doesn't set the actual charset. Look at the table and the database character set, it should be UTF8 or UTF8MB4. If it's not then you've got a character set mismatch.

GordonM
  • 31,179
  • 15
  • 87
  • 129
  • i searched phpmyadmin but i cant find character set field. can you please help me find it? thanks – Arman Zekavat Apr 25 '16 at 14:35
  • You can find out by doing a query. http://stackoverflow.com/questions/11757966/how-to-find-out-the-charset-of-a-database-and-table-with-phpmyadmin should help. Alternatively you could use the export to export the table structure (view export as text, mode SQL, structure only). PhpMyAdmin isn't a very nice tool and if you have the option you should look at alternatives such as Yog (for Windows), Sequel Pro (for Mac), etc – GordonM Apr 25 '16 at 15:44