SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Can we go to a 48 hour day?
    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
    Now the BDate is a date field and I am trying to get this to allow me to pass in some wildcard values to get a series of records rather than just one.

    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.

    Thanks
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  2. #2
    SitePoint Guru
    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....

    Peanuts
    the neigbours (free) WIFI makes it just a little more fun

  3. #3
    Can we go to a 48 hour day?
    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.

    Thanks
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •