SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: re-using query help
-
May 20, 2003, 05:45 #1
- Join Date
- May 2002
- Location
- MI
- Posts
- 906
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
re-using query help
I hav a query that I use for getting a specific record. There are five keys that make up the pk of the table.
PHP Code:$query = "Select * FROM schedule
WHERE CourseNum = '" . $this->CourseNum . "' AND
SectionNum = " . $this->SectionNum . " AND
PidNum = '" . $this->PidNum . "' AND
BDate = '" . $this->BDate . "' AND
Preceptor = " . $this->Preceptor;
I can change the text based fields (like course number) from = to LIKE and use %, but how can I get this to work with the date. If I change the BDate to LIKE it breaks.
Thanksmitechie.com
"Techies just think a little differently
...at least that is what they keep telling me."
-
May 20, 2003, 08:32 #2
- Join Date
- Aug 2001
- Location
- Amsterdam
- Posts
- 788
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hmmm you could just use the date functions that mysql offers to do all kind of nice tricks ...
The most common are
where date > $begin and date < $end
of
where date between $begin and $end
these ofcourse only work if mysql knows that the field is date...
also check
http://www.mysql.com/documentation/m...e_calculations
good luck....
Peanutsthe neigbours (free) WIFI makes it just a little more fun
-
May 20, 2003, 08:44 #3
- Join Date
- May 2002
- Location
- MI
- Posts
- 906
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think I goofed something else. I played with it some more and I have gotten it to work out.
Thanksmitechie.com
"Techies just think a little differently
...at least that is what they keep telling me."
Bookmarks