TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-07-2011, 01:47 AM   #1 (permalink)
The Wanderer
 
Join Date: Jan 2010
Posts: 13
Thanks: 0
pepelepew1962 is on a distinguished road
Default 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";
pepelepew1962 is offline  
Reply With Quote
Old 03-07-2011, 02:36 PM   #2 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

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



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Mail - Help sending multiple attachments xperience Absolute Beginners 5 09-06-2010 08:27 AM
Multiple CheckBox OpenBSD Advanced PHP Programming 2 08-30-2010 11:12 PM
Getting the dates between 2 dates kawasaki General 4 03-14-2009 04:16 PM
Passing multiple arguments to a function via one variable. delayedinsanity Advanced PHP Programming 10 05-07-2008 05:04 AM
Multiple Servers? Sam Granger Advanced PHP Programming 5 02-08-2008 03:14 PM


All times are GMT. The time now is 05:37 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design