我从 mysql 获取时间,格式为:hh:mm:ss 我需要将它与当前时间进行比较,但它不起作用
$result = mysql_query('SELECT * FROM events WHERE clubID = "'.$clubID.'" ORDER BY date ASC, TIME(startTime) ASC');
while ($row = mysql_fetch_assoc($result)) {
$originaltime = $row['endTime'];
$time = new DateTime($originaltime);
if($time < time())
mysql_query('UPDATE events SET passed="1" WHERE eventID = "'.$row['eventID'].'"');
}
如果当前时间已经超过 $time(来自 mysql),我希望 if 语句发生