-2

我正在尝试过滤所有即将举行的会议的列表到目前为止,我正在使用此查询

$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
                        }}

为什么上述声明没有打印即将举行的会议?

4

1 回答 1

0

也许是因为你做meeting_datetime >= curdate()的和事后相反if ($date > $row['meeting_datetime'])

因此,只需将 > 替换为 < 或 <=

于 2012-09-21T10:38:00.993 回答