nfear24
Posts: 41
|
| Posted: 10/23/2007, 5:10 PM |
|
I am trying to set up a search between dates. should be easy but is not working. I have a database named WORK. I have 2 text boxes, INITIAL_DATE and FINAL_DATE. Dates are in this format in the database yyyy-mm-dd and search boxes.
Here is my sql statement.
SELECT *
FROM work
WHERE date >= '{INITIAL_DATE}'
AND date <= '{FINAL_DATE}'
For some reason when I run the search, it will only grab data with that exact date of the INITIAL_DATE box. Any clue what I am doing wrong?
Thanks
|
 |
 |
mamboBROWN
Posts: 1713
|
| Posted: 10/24/2007, 5:42 PM |
|
nfear24
What version of MySQL do you have?? Have you run your query in MySQL and received the same results?? Have you checked your data to see if you have any data that is in the date range?? Also you might want to give this a try in the place of date , date(now())
|
 |
 |
nfear24
Posts: 41
|
| Posted: 10/24/2007, 6:19 PM |
|
Quote mamboBROWN:
nfear24
What version of MySQL do you have?? Have you run your query in MySQL and received the same results?? Have you checked your data to see if you have any data that is in the date range?? Also you might want to give this a try in the place of date , date(now())
I am using MySQL 5.1.22. Yes I have run my query in MySQL and it works fine and finds the data I would expect it too. This is what I am very frustrated about why wont it work in codecharge. the date(now()) you refer to, well the date is the mysql feild so I cant put that in there.
SELECT *
FROM work
WHERE date >= '{INITIAL}'
AND date <= '{FINAL}'
|
 |
 |
nfear24
Posts: 41
|
| Posted: 10/24/2007, 8:50 PM |
|
Even if I set it to be just >. Why in the heck would it only do =. driving me crazy here. Always brings up the date that equals and thats it.
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 10/25/2007, 2:10 AM |
|
nfear24
Do an echo of the Initial and final date, just before the SELECT.
this will show you the true contnet of these fields, either there is no content or both are equal.
I would like to know the full context in which you are doing this:
Are you programming in an event, or are you showing us the content of the visual query builder?
This is, when database properties are set up right, a basic task.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
nfear24
|
| Posted: 10/25/2007, 3:09 PM |
|
Quote wkempees:
nfear24
Do an echo of the Initial and final date, just before the SELECT.
this will show you the true contnet of these fields, either there is no content
or both are equal.
I would like to know the full context in which you are doing this:
Are you programming in an event, or are you showing us the content of the
visual query builder?
This is, when database properties are set up right, a basic task.
Walter
Yes the dates are correct in the search. I am just using the visual query
builder to set this up. Couldnt be simpler I would think. Database is setup as
date field and format of yyyy-mm-dd and its passing the dates in that format.
Nick
---------------------------------------
Sent from YesSoftware forum http://forums.yessoftware.com/
|
|
|
 |
nfear24
Posts: 41
|
| Posted: 10/26/2007, 7:26 PM |
|
Problem solved. My query builder was correct in the search but for some reason somehow there was another query builder in the system that it wasnt showing up. Weird.
|
 |
 |
wkempees
|
| Posted: 10/27/2007, 2:25 PM |
|
Congratulations!
As I have stated earlier, trash it and build anew.
That will take lots less time than solving a problem.
Walter
"nfear24" <nfear24@forum.codecharge> schreef in bericht
news:54722a1bd078e0@news.codecharge.com...
> Problem solved. My query builder was correct in the search but for some
> reason
> somehow there was another query builder in the system that it wasnt
> showing up.
> Weird.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
nfear24
Posts: 41
|
| Posted: 10/27/2007, 3:04 PM |
|
I just dont like to trash things when they should be working or showing.
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 10/29/2007, 4:30 AM |
|
Agreed, but sometimes starting fresh eliminates errors made by experimenting.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |