我正在尝试检查数据库中一行和某一列的时间是否比今天更早,然后回显成功,但它正在回显明天的日期成功!
代码
// Set variable for the time
$timenow = date('l jS \of F Y h:i:s A');
// Start Expired password check and drop function
function cronexec_expired ($timenow) {
include('../../config.php');
// Open up a new MySQLi connection to the MySQL database
mysql_connect($dbHost, $dbUsername, $dbPassword);
mysql_select_db($dbTable);
// Query to check the status of the code input
$expiry_check = "SELECT * FROM code_log WHERE status='Unused'";
// Run the query
$expiry_checkexec = mysql_query($expiry_check);
while($expiry_possibles = mysql_fetch_array($expiry_checkexec)) {
echo $expiry_possibles[6] . '<br /><br />';
echo $timenow . '<br /><br />';
if (date('l jS \of F Y h:i:s A', strtotime($expiry_possibles[6]) < $timenow)) {
echo "Success";
}
}
}
$expiry_possibles[6] 值
Monday 9th of September 2013 12:46:20 PM
是时候了
Sunday 8th of September 2013 01:35:22 PM
任何意见,将不胜感激