简体   繁体   中英

inserting special characters like alpha,beta in MySQL database

How can I insert alpha,beta,delta into a MySQL database through php script?

I want to save my subject codes to my db table using these special characters.

Example subject code CSC113α .

From this website:

Declare @t table( id int, txt nvarchar(20))
Insert Into @t Values (1, N'αβγδ')
Insert Into @t Values (2, nchar(945)+nchar(946)+nchar(947)+nchar(948))

So, just make this into PHP, and you're set.

Set the text collation of the field you are trying to insert to, to UTF8 and try to insert the special character again.

ALTER TABLE `table_name`
MODIFY COLUMN `column_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM