2017-05-08 121 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()函数造成的。