1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Search array using MYSQL

Discussion in 'Web Design & Development' started by DrP, Apr 3, 2008.

Thread Status:
Not open for further replies.
  1. DrP

    DrP Thread Starter

    Joined:
    Jul 23, 2005
    Messages:
    739
    One of the columns in my MySQL database contains an array of names. I would like to select rows from the db which only contain certain names within that array. Is that possible? I'd like to do it using a MySQL command if possible.
    Thanks,
     
  2. cpscdave

    cpscdave

    Joined:
    Feb 25, 2004
    Messages:
    444
    Use the in command

    Select * FROM table where name in ('name1','name2'....)
     
  3. DrP

    DrP Thread Starter

    Joined:
    Jul 23, 2005
    Messages:
    739
    Do you mean something like this?

    SELECT * FROM records WHERE records_audience IN 'Joe Bloggs';

    because all I'm getting is:

    Parse error: syntax error, unexpected '*' in...

    I've tried changing the code around but it still isn't working. Is there another method? I basically want something like the search and REPLACE command for MySQL without having to replace.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Similar Threads - Search array using
  1. JDLinn
    Replies:
    4
    Views:
    463
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/699927

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice