我想知道如何在mysql中插入大写。我有一个表格,询问用户的名字,当他们进入他们的例如汤姆布朗。我想把它作为汤姆布朗插入到数据库中。我需要把ucfirst放在哪里才能实现。我试过了
$info = mysql_query("INSERT INTO workname(email,fname,lname,gender,position) VALUES
('$email',ucfirst'$fname',ucfirst'$lname','$gender','$position' )");
// didn't work
$info = mysql_query("INSERT INTO workname(email,fname,lname,gender,position) VALUES
ucfirst('$email','$fname','$lname','$gender','$position' )");
// not what i want, didn't work
$info = mysql_query("INSERT INTO workname(email,fname,lname,gender,position) VALUES
('$email',ucfirst('$fname'),ucfirst('$lname'),'$gender','$position' )");
// didn't work
请帮助我在哪里以及我做错了什么。
答案 0 :(得分:1)
$info = mysql_query("INSERT INTO workname(email,fname,lname,gender,position) VALUES
('$email','".ucfirst($fname)."','".ucfirst($lname)."','$gender','$position' )");
或者这个更好
$fname = ucfirst($fname);
$lname= ucfirst($lname);
$info = mysql_query("INSERT INTO workname (email,fname,lname,gender,position) VALUES
('$email','$fname','$lname','$gender','$position' )");