大写函数在php中不起作用

时间:2014-12-20 07:38:44

标签: php phpmyadmin

我有一个PHP文件,我想在其中将用户输入转换为大写字母,所以我使用了PHP的strtoupper()函数,但它无法正常工作。这是我的代码

$eno =@$_SESSION['eno'];
$eno =strtoupper($eno);

现在将它插入数据库时​​,它仍然是小写字母。这是插入查询。

$sql="INSERT INTO `student_info`(`student_no`,`High_School_Name`, `Year_Of_Passing`, `Higher_Secondary_School_Name`, `Year_Of_Passing1`, `Enrollment_Number`, `Roll_Number`, `Current_Course`, `Current_Sem`, `Current_section`, `Enrollment_Year`, `Alternate_Email`)VALUES('$studentno','$High_School_Name','$Year_Of_Passing10','$Higher_Secondary_School_Name','$Year_Of_Passing12','$eno','$Roll_Number','$Current_Course','$Current_Sem','$Current_section','$Enrollment_Year','$Alternate_Email' )";

2 个答案:

答案 0 :(得分:0)

 $eno='vikram';
 echo $eno =strtoupper($eno);

enter image description here

 $sql="INSERT INTO `student_info`(`student_no`,`High_School_Name`, `Year_Of_Passing`, `Higher_Secondary_School_Name`, `Year_Of_Passing1`, `Enrollment_Number`, `Roll_Number`, `Current_Course`, `Current_Sem`, `Current_section`, `Enrollment_Year`, `Alternate_Email`)VALUES('".$studentno."','".$High_School_Name."','".$Year_Of_Passing10."','".$Higher_Secondary_School_Name."','".$Year_Of_Passing12."',ucase('".$eno."'),'".$Roll_Number."','".$Current_Course."','".$Current_Sem."','".$Current_section."','".$Enrollment_Year."','".$Alternate_Email."' )";

在查询中使用此功能:选择UCASE(' vikram')

enter image description here

答案 1 :(得分:0)

没有问题

echo $eno;

..看看结果。