我通过从特定功能调用来解决inserting
数据问题。它没有给我任何错误,但它不会插入。
这是代码
function log_($moderator, $actions, $conn)
{
try
{
$log = $conn->prepare("INSERT INTO moderation-history(moderator, action, date, ip_addr) VALUES (:Moderator, :Action, ".time().", ".$_SERVER['REMOTE_ADDR'].")");
$log->bindParam(':Moderator', $moderator, PDO::PARAM_STR, 100);
$log->bindParam(':Action', $actions, PDO::PARAM_STR, 100);
$log->execute();
}
catch(PDOException $e)
{
error_log("PDOException: " . $e->getMessage());
}
}
以及主持人更改权限后执行的代码
log_($user, "Altered ".$username." Permissions", $conn);
执行此功能应插入数据。作为$ user = Moderator,2nd = Action,$ conn = DB Connection。