【发布时间】:2015-07-16 21:53:07
【问题描述】:
我想从用户访问页面时当前日期所在的数据库中提取表。
表格示例:
---+----------+-----------
ID | from | to
---+----------+-----------
1 |2015-07-01|2015-07-14
---+----------+-----------
2 |2015-07-15|2015-07-31
---+----------+-----------
3 |2015-08-01|2015-08-20
输出:
如果日期为2015-07-10,则输出应为ID 1
如果日期为2015-08-02,则输出应为ID 3
【问题讨论】:
-
where curdate() between `from` and `to` -
如果日期是2015-08-21呢?
-
@Strawberry if(!$row_sample){ echo do something;}
标签: php mysql date mysqli between