我正在尝试过滤所有即将举行的会议的列表 到目前为止,我正在使用此查询
$sql = "SELECT * from demo_meeting WHERE created_by_id IN(SELECT id FROM demo_user WHERE user_name = '$get_user_name') AND venue_id IS NULL AND meeting_datetime >= curdate() ORDER BY meeting_datetime ";
mysql_real_escape_string($sql);
$result = mysql_query($sql) or die (mysql_error());
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
//date_default_timezone_set('Australia/Melbourne');
date_default_timezone_set('Asia/Calcutta'); // Change it as per user requirement
$date = date('Y-m-d H:i:s ', time());
if ($date > $row['meeting_datetime']){
?>
<tr><td>
<div class= "main" style ="margin-top: 5px; padding: 15px 14px;background:#fff">
<div class = "bold" > Name :<?php echo $row['name']; ?><br> </div>
<div class = "bold" > Date :<?php echo $row['meeting_datetime']; ?></div>
</div>
<div class = "clear"></div>
</td></tr>
<?php
}}
为什么以上陈述不打印即将举行的会议?
答案 0 :(得分:0)
也许是因为你meeting_datetime >= curdate()
和之后相反if ($date > $row['meeting_datetime'])
?
所以,只需替换&gt;通过&lt;或&lt; =