以大写形式将数据存储到mysql中

时间:2013-10-08 06:10:24

标签: php mysql database wamp

如何以大写字母存储数据?

查询

$personal_date_birth = checkDateY($personal_date_birth);

mysql_query("UPDATE personal_data SET personal_full_name = '".mysql_real_escape_string($personal_full_name)."', personal_title = '".mysql_real_escape_string($personal_title)."', personal_date_birth ='".mysql_real_escape_string($personal_date_birth)."', personal_marital_status = '".mysql_real_escape_string($personal_marital_status)."', personal_nationality = '".mysql_real_escape_string($personal_nationality)."', personal_race = '".mysql_real_escape_string($personal_race)."', personal_religion = '".mysql_real_escape_string($personal_religion)."', personal_gender = '".mysql_real_escape_string($personal_gender)."', personal_country_birth = '".mysql_real_escape_string($personal_country_birth)."', personal_bumiputra_status = '".mysql_real_escape_string($personal_bumiputra_status)."' WHERE LAS_login_id = '".mysql_real_escape_string($LAS_login_id)."'")

5 个答案:

答案 0 :(得分:2)

使用strtoupper()功能

试试这个

$personal_date_birth = checkDateY($personal_date_birth); 
mysql_query("UPDATE personal_data SET 
personal_full_name='".mysql_real_escape_string(strtoupper($personal_full_name))."',
personal_title = '".mysql_real_escape_string(strtoupper($personal_title))."',
personal_date_birth ='".mysql_real_escape_string(strtoupper($personal_date_birth))."',
personal_marital_status = '".mysql_real_escape_string($personal_marital_status)."',
personal_nationality = '".mysql_real_escape_string(strtoupper($personal_nationality))."',
personal_race = '".mysql_real_escape_string(strtoupper($personal_race))."',
personal_religion = '".mysql_real_escape_string(strtoupper($personal_religion))."',
personal_gender = '".mysql_real_escape_string(strtoupper($personal_gender))."',
personal_country_birth = '".mysql_real_escape_string(strtoupper($personal_country_birth))."',
personal_bumiputra_status = '".mysql_real_escape_string(strtoupper($personal_bumiputra_status))."' 
WHERE LAS_login_id = '".mysql_real_escape_string($LAS_login_id)."'")

答案 1 :(得分:1)

使用“strtoupper()”函数,将文本放在所需的括号内作为大写。

答案 2 :(得分:1)

你应该像在Ankur中所说的那样在PHP中进行。 但你也可以使用UPPER('string');

在MySQL中完成

答案 3 :(得分:0)

尝试这样......

UPDATE products_description SET `products_name` = UPPER( `products_name` ) 

答案 4 :(得分:0)

使用如下:

INSERT INTO `sample_table`(`name`) values(UPPER('new text'))