The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

simple MySQL query

Discussion in 'General Discussion' started by BigLebowski, Jun 1, 2009.

  1. BigLebowski

    BigLebowski Well-Known Member

    Joined:
    Dec 24, 2007
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    hi there

    Quick question. I have a table full of char(255) rows with plain text in them. I wish to search through for any instance of four or 16 digits, eg
    1234 or 1234567812345678 or 1234-5678-1234-5678
    (I'm trying to locate credit card numbers).

    I'm a bit rusy on SQL. anyone suggest a select statement pls?

    The field is called "thread_content_part"

    Cheers
    Dude
     
  2. elleryjh

    elleryjh Well-Known Member

    Joined:
    Apr 12, 2003
    Messages:
    479
    Likes Received:
    0
    Trophy Points:
    16
    Code:
    SELECT `thread_content_part` FROM `table_name` WHERE `thread_content_part` LIKE = '%1234%'
    or to select the whole row:

    Code:
    SELECT * FROM `table_name` WHERE `thread_content_part` LIKE = '%1234%'

    Of course replace table_name with the actual table name.
     
Loading...

Share This Page