SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL SELECT question. Help please!

    I'm making a search page to view properties of certain characteristics (ie 2 bedrooms, 1 bathroom etc). I'll pass on the choices of the users as variables from a form. What I want to know is how to include an 'any value' in the WHERE statement ie SELECT ....... WHERE bedrooms = 'any value' AND bathrooms = '1' AND ...

    My problem is how to make MySQL understand 'any value'. There is no doubt a simple answer as it must be possible....

    Help please!

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it's not specified, just leave it out.

    eg: (pseudocode)
    Code:
    if(bedrooms value other than "any"){
        $SQL .= " AND bedrooms='1'"
    }
    ----Adopt-a-Sig----
    Your message here!

  3. #3
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    that works fine!

    Thanks very much - I knew there had to be a simple answer.


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
  •