1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Selecting non alphabetical values from a DB

Discussion in 'MySQL' started by exaro, Mar 3, 2007.

  1. #1
    I'm using mySQL with PHP and I'm looking to pull some VARCHAR data from a database. I have a listing on my site that pulls up information by first letter based on a link someone clicks.

    Example page.php?search=P

    The query is something like SELECT from DB WHERE field LIKE $search ORDER BY ASC

    I wanted to put a link so that I could pull out all the values that do not begin with a letter.

    The idea I had was to select all data from the table, list it ascending, and stop pulling data out when the names start beginning with a letter. I have the concepts in my head but I'm not sure how to put them into code.

    Anyone know what will get me goin in the right direction?
     
    exaro, Mar 3, 2007 IP
  2. rajnikant

    rajnikant Peon

    Messages:
    18
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This could be helpfull

    SELECT * from DB WHERE field NOT LIKE '$search%' ORDER BY ASC
     
    rajnikant, Mar 5, 2007 IP
  3. spachev

    spachev Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    SELECT field from DB WHERE NOT (field REGEXP '^[a-zA-Z]') ORDER BY ASC
     
    spachev, Mar 8, 2007 IP