简体   繁体   English

没有查询结果 - mysql

[英]No query results-mysql

I have db in which fields which i need to mention here is start date and end date. 我有数据库,我需要在这里提到的字段是开始日期和结束日期。

In php file i am taking todays date with the code. 在PHP文件中我今天带着代码。

$today=date("Y-m-d");//2014-02-06

I am considering 1 row of table where, start date is 2014-02-11 and 我正在考虑1排表,开始日期是2014-02-11和

end date is 2014-02-27 截止日期为2014-02-27

my sql query is below 我的SQL查询如下

SELECT * FROM `listing_offer` WHERE '2014-02-06' BETWEEN 'start_date' AND 'end_date'

but it returning all times no rows .!! 但它总是没有返回行。!! did any 1 have face this problem. 任何1人都面临这个问题。 and also guide me if there is syntax error 并且如果有语法错误也指导我

使用SELECT * FROM listing_offer WHERE'start_date'> ='2014-02-06'AND'end_date'<='2014-02-06'

 $today=date("Y-m-d");

 $valtoday='\''.$today.'\'';

sql query would be sql查询会

select * from table where $valtoday BETWEEN start_date and end_date;

//valtoday getting value with quotes to be used in select statement of sql. // valtoday获取带引号的值,用于在sql的select语句中使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM