日期之间的数据显示所有头

时间:2013-10-19 02:47:07

标签: javascript php jquery mysql ajax

我有三个领域开始日期结束日期HeadName我希望在日期之间搜索数据我能够获得但是头文名未被过滤。它显示所有结果

Sno HeadName    Date    Amount  BillNo  BillDate    PaymentMode BankName    ChequeNo    Remarks Center
1   8   2013-10-18  0   0   2013-10-26  Select      0       Bhopal
2   3   2013-10-20  0   0   2013-10-20  Select      0       0

现在这个头名应该只有8和3不应该显示 我的代码是

    $res = mysql_query("SELECT  * FROM CashbookMaster WHERE `Date` BETWEEN '$start_time' AND '$stop_time'"  );
while( $row = mysql_fetch_array($res) )

1 个答案:

答案 0 :(得分:1)

如果您还要对HeadName进行过滤,则需要将其添加到WHERE子句

$res = mysql_query("SELECT  * FROM CashbookMaster WHERE `Date` BETWEEN '$start_time' AND '$stop_time' AND HeadName = 8"  );
while( $row = mysql_fetch_array($res) )