douzhimei8259 2013-11-20 21:28
浏览 24
已采纳

PHP ucword mysql插入

I am having a problem capiltalizing the first letter of the "ondeck" insert. I am trying to use ucwords but I am unsure of where to put that in the following statement:

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO updates (windowStatus, onDeck, updateComments, username) VALUES (%s, %s, %s, %s)",
                   GetSQLValueString($_POST['windowStatus'], "text"),
                   GetSQLValueString($_POST['onDeck'], "text"),
                   GetSQLValueString($_POST['updateComments'], "text"),
                   GetSQLValueString($_POST['username'], "text"));

Please advise. Thank you!

  • 写回答

1条回答 默认 最新

  • dongtiao1817 2013-11-20 21:33
    关注

    PHP´s ucfirst capitalizes the first letter of a string. See http://us1.php.net/ucfirst

    So to capitalize you probaply want to

    GetSQLValueString(ucfirst($_POST['onDeck']), "text")
    

    Or ucwords if that´s what you need. Assuming GetSQLValueString is some sort of sql injection security. Otherwise, you might want to read up on SQL injection techniques

    http://en.wikipedia.org/wiki/SQL_injection

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效