Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Thanked 3 Times in 3 Posts

    how to search only letters and numbers in tables

    I wish to know how google does their search, say there is a road called St. John's Road in my database and I type in my ajax-auto-sugestion field...

    St John

    How can I get the auto-selection to show the road that is LIKE the content but do not use the . or the ' in the database

    If I was to start to type...

    St. John

    then it would of course show the suggestion as I used the .

    Can this be done ?

    My fields have the proper names of the roads and I use utf8_general_ci for the road name field and the LIKE method to get the results.

  2. #2
    New Coder
    Join Date
    Aug 2009
    Thanked 1 Time in 1 Post


    Perhaps you could use the replace method, along the lines of:

    SELECT * FROM tRoad WHERE replace(road, '.', '') LIKE '%searchterm%';
    I don't entirely know how the replace syntax works, so you may need to do a little research around it and see if it can suit the needs of your problem here.
    Last edited by Owener94; 04-17-2014 at 02:30 PM.


Posting Permissions

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