簡體   English   中英

數據不會插入數據庫[php] [pdo]

[英]Data won't insert into Database [php][pdo]

我目前一直在嘗試使其插入要插入的當前票證的數據,但不會插入。

function insertTicketSubmission($title, $subject, $question)
{
    global $database;
    global $error;

    $sth = $database->prepare("INSERT INTO `tickets` (`TicketId`, `PlayerId`, `Title`, `Subject`, `Question`, `Date`, `Status`) VALUES (:TicketID, :PlayerID, :Title, :Subject, :Question, GETDATE(), Pending)");
    $sth->bindParam(":TicketID", generateRandomString());
    $sth->bindParam(":PlayerID", $_SESSION["userId"]);
    $sth->bindParam(":Title", $title);
    $sth->bindParam(":Subject", $subject);
    $sth->bindParam(":Question", $question);
    if($sth->execute())
    {
        $error = sendError("success", "Your Ticket has been submitted.");
    }
}

完全沒有錯誤,只是不會插入表中。

我想到了! 問題是GETDATE()函數的原因。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM