SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: MySQL problem

  1. #1
    SitePoint Enthusiast itportal's Avatar
    Join Date
    Sep 2005
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL problem

    Hello,

    I have a small problem. I use a query like this to search for specific strings in the DB:

    Code:
    select * from table where text like "%sth%"
    The problem is that it'll find only strings exactly matching "sth". It won't find "sTh" or "STH".

    Any ideas?

  2. #2
    SitePoint Enthusiast itportal's Avatar
    Join Date
    Sep 2005
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, posted in wrong forum

  3. #3
    Obey the Purebreed trib4lmaniac's Avatar
    Join Date
    Dec 2004
    Location
    Cornwall, UK
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    select * from table where LOWER(text) like LOWER("%sth%")

  4. #4
    SitePoint Enthusiast itportal's Avatar
    Join Date
    Sep 2005
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, but when it returns the results, they will all be lowercase and I don't want that

  5. #5
    Obey the Purebreed trib4lmaniac's Avatar
    Join Date
    Dec 2004
    Location
    Cornwall, UK
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No it won't.

  6. #6
    SitePoint Enthusiast itportal's Avatar
    Join Date
    Sep 2005
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, I'll try thanks

  7. #7
    SitePoint Enthusiast itportal's Avatar
    Join Date
    Sep 2005
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, it works


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
  •