我的脚本错误日志iam使用php 5.3版本出现了这些错误,这是我的代码:
// add entry
$sql = "INSERT INTO plugin_reward_ppd_detail (reward_user_id, download_ip, file_id, download_country_group_id, download_date, reward_amount, status)
VALUES (:reward_user_id, :download_ip, :file_id, :download_country_group_id, :download_date, :reward_amount, 'pending')";
$vals = array('reward_user_id' => $file->userId,
'download_ip' => $usersIp,
'file_id' => $file->id,
'download_country_group_id' => $countryGroupId,
**'download_date' => sqlDateTime(),**
'reward_amount' => $rewardAmount);
$db->query($sql, $vals);
}
我确实错了:
' download_date' => SQLDATETIME()
答案 0 :(得分:0)
如果你想在download_date列上添加当前时间,你可以试试这个
use DATE(''YYYY-MM-DD HH:MM:SS');
$vals = array('reward_user_id' => $file->userId,
'download_ip' => $usersIp,
'file_id' => $file->id,
'download_country_group_id' => $countryGroupId,
'download_date' =>DATE('YYYY-MM-DD HH:MM:SS'),
'reward_amount' => $rewardAmount);
$db->query($sql, $vals);
}
OR
other wise set download_date MySQL data-type: TIMESTAMP –
Defulat value select : CURRENT_TIMESTAMP
This an advanced version of DATETIME datatype. It has the same format as before. Unlike DATETIME, TIMESTAMP stores the current date and time on the creation of the table and on every update automatically. You do
not need to change its value every time