Sql Wildcards Select HAS

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coolgames
    New Member
    • Oct 2007
    • 168

    Sql Wildcards Select HAS

    Hello, we're having a spam problem where a user spams:

    websitename.com

    and we blocked that... but now they're spamming like:

    w e b sit e.c !! om

    w!e!B!s!i!t!e!. !c!o!m
    etc....


    so how can we select a field that has the following chars:

    e i p x w r a x

    ? no matter how they're displayed.... even like --> epixwrax, e p i x w ! r a x

    I tried:
    Code:
    SELECT * FROM `commentary` WHERE comment LIKE  '%.%' '%c%' '%o%' 'm%' '%e' '%p%' '%i%' '%c%' '%w%' '%a%' '%r%' '%x%'
    but that doesn't work when they put in symbols like:

    e#p!i x w@ar#x

    can i select a value where it has ALL the chars listed... (epixwarx)
    thanks :)
  • SLauren
    New Member
    • Feb 2009
    • 60

    #2
    If you are specific to "e i p x w r a x" and maintain the order of the characters as you specified in the given word then, the following query might help:

    Code:
    SELECT * FROM tablename WHERE columnvalue LIKE  '%e%i%p%x%w%r%a%';
    Thanks,
    Lauren

    Comment

    • coolgames
      New Member
      • Oct 2007
      • 168

      #3
      please delete this post mod --------------------
      Last edited by coolgames; Aug 12 '09, 12:42 PM. Reason: posted wron

      Comment

      • coolgames
        New Member
        • Oct 2007
        • 168

        #4
        hey, it is the same order but what if they insert characters between like spaces and stuff?

        does it still work?

        thanks a lot

        Comment

        • SLauren
          New Member
          • Feb 2009
          • 60

          #5
          I tried with spaces also as an example and it worked.
          You can try running the below sample query:

          Code:
          SELECT IF('lllle!g g ipg  ggxgg!wfff!rggg!affffx' like '%e%i%p%x%w%r%a%','eesde','nothing');
          I put spaces in between also.

          Thanks,
          Lauren

          Comment

          • coolgames
            New Member
            • Oct 2007
            • 168

            #6
            hello, sorry for bothering again but how can i execute that?

            table = commentary
            field = comments

            can you please convert it onto this form --> SELECT * FROM `commentary` WHERE `comments` .......

            and the site's name is epicwarx.

            thanks so much!

            Comment

            • SLauren
              New Member
              • Feb 2009
              • 60

              #7
              You can execute the sample query, which i posted, from mysql command line or query browser(Windows ).

              The query can be written as:

              Code:
              SELECT * FROM `commentary` WHERE `comments` LIKE '%e%i%p%x%w%r%a%';
              Thanks,
              Lauren

              Comment

              • coolgames
                New Member
                • Oct 2007
                • 168

                #8
                thanks once again so much :) it works!

                Comment

                Working...