Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pulling data from database based on first letter

    I've researched this and tried to code it myself but I havent had any luck. I want to pull data off a database, IE: first name, etc , based on the first letter. So I would have something like A B C and if you click on those letters they will bring up all the names or whatever field that start with that letter. Please help, I've spent countless hours trying to figure this out!


    Thanks,
    -Nate

  • #2
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    wallport10 are you using Mysql? have you tried
    PHP Code:
    SELECT FROM table WHERE first_name LIKE A 
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #3
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Use the "like" keyword along with the "%" wildcard:
    PHP Code:
    $query "SELECT * from yourtable where lastname like 'A%'"
    You would of course want to replace that "A" with the value the user clicks on.

  • #4
    New Coder
    Join Date
    Aug 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Awsome, Thanks alot!

    -Nate


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •