how to insert upper case in mysql
i would like to know how to insert a upper case in mysql. i have a form that ask the user for their name, when they enter their for example tom brown. I would like to insert this into the db as Tom Brown instead. where would i need to put ucfirst for this to happen. i tried
$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 wo开发者_开发百科rk
Please help where and what am i doing wrong.
is this php? try this.
$info = mysql_query("INSERT INTO workname(email,fname,lname,gender,position) VALUES
('$email','".ucfirst($fname)."','".ucfirst($lname)."','$gender','$position' )");
or this much better
$fname = ucfirst($fname);
$lname= ucfirst($lname);
$info = mysql_query("INSERT INTO workname (email,fname,lname,gender,position) VALUES
('$email','$fname','$lname','$gender','$position' )");
精彩评论