TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Absolute Beginners (http://www.talkphp.com/absolute-beginners/)
-   -   Multiple WHERE with dates ... (http://www.talkphp.com/absolute-beginners/5808-multiple-where-dates.html)

pepelepew1962 03-07-2011 01:47 AM

Multiple WHERE with dates ...
 
Hello:

I am trying to get my mysql query working and it says it is empty, which is impossible because I am picking information that I KNOW is in the table. What I am trying to do is to get 2 date variables from my form and to search my table within those dates. I do not know if it matters, but my table fields also have h:m:s while my date variables don't. I have tried many variances but continue to fail. Can anyone help me please.
//
//
$frmQuery1101 = "SELECT tblTable1.fldField00, tblTable1.fldField19, tblTable1.fldField27, tblTable2.fldField00, tblTable2.fldField01, tblTable2.fldField02, tblTable2.fldField03, tblTable2.fldField04, tblTable2.fldField05 FROM tblTable1, tblTable2 WHERE (tblTable1.fldField00 = tblTable2.fldField00) AND WHERE tblTable2.fldField02 BETWEEN $frmDate01 AND $frmDate02 ORDER BY tblTable1.fldField19,tblTable1.fldField00";

tony 03-07-2011 02:36 PM

without any other clue, i would say that you have to put the dates in quotes, like:
sql Code:
... BETWEEN '$frmDate01' AND '$frmDate02' ...


All times are GMT. The time now is 01:30 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0