2017-05-08 170 views
0

我目前一直在嘗試使它插入當前正在放置的票證的數據,但它不會插入。數據將不會插入到數據庫[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."); 
    } 
} 

根本沒有錯誤,只是不會插入表格。

+0

'待定'是一個字符串? – chris85

+1

'pending'!==':pending' – RiggsFolly

+1

而你沒有綁定一個'pending' – RiggsFolly

回答

0

我想通了!該問題是由於GETDATE()函數造成的。