SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member martinal's Avatar
    Join Date
    Jun 2004
    Location
    Yorkshire, UK
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySql Wildcards help needed!

    Hi All

    HELP!! I've searched the forum and all the references to wildcards seem to be for searching for words but I can't find anything for numbers and the % doesn't seem to work.

    What I have is a data base of homes which specifies No. of Bedrooms, Max Occupancy and Location. What I want to do is have an advanced search which lets you select a specific number or All. If all are selected then I want to pickup everything? I've tried putting % in a variable and in the MySql query e.g.no_bedrooms = '%$noofbeds%' but none of them work.

    Any help would be appreciated.

    Cheers
    Martin

  2. #2
    SitePoint Addict streetlife's Avatar
    Join Date
    Mar 2004
    Location
    D-Town
    Posts
    369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use 'LIKE' instead of '='
    Code:
    no_bedrooms LIKE '%$noofbeds%'

  3. #3
    SitePoint Member martinal's Avatar
    Join Date
    Jun 2004
    Location
    Yorkshire, UK
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was just about to post "NEVER MIND I'M STUPID, I'VE SPOTTED MY MISTAKE". I've been looking at the code for a week now and I just couldn't see the wood for the trees!

    Thanks for the reply!

  4. #4
    get into it! bigduke's Avatar
    Join Date
    May 2004
    Location
    Australia
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might want to take a look in the MySQL manual for the REGEXP clause, its a lot more powerful than the LIKE clause, it might be what you're looking for.


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
  •