adrek Posted June 17, 2009 Share Posted June 17, 2009 i have a script that will get artciles based of a title from a database. i tried to use easy to remember urls so my page looks like this http://example.com/title-of-article/ which works fine. I want to avoid using any symbols other than the dash, to represent the space, in the url. Some of the articles of periods or other punctuation in the title. is there a way to ignore that in a query. so like /title-of-this-article/ could return "Title. of This. Article" or something like that? i tried using the LIKE statement but then it returns any titles that are similar and i want it to just return that one. any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/162500-solved-ignoring-symbols-in-query/ Share on other sites More sharing options...
MadTechie Posted June 17, 2009 Share Posted June 17, 2009 You could pre-filter and replace anything that's not a [0-9a-z] with a % and use then use LIKE Quote Link to comment https://forums.phpfreaks.com/topic/162500-solved-ignoring-symbols-in-query/#findComment-857688 Share on other sites More sharing options...
adrek Posted June 17, 2009 Author Share Posted June 17, 2009 You could pre-filter and replace anything that's not a [0-9a-z] with a % and use then use LIKE im already stripping out the punctuation and the final string is in the url so when it gets put through the sql query its already stripped of its punctation. should i replace the spaces with the %? EDIT: ok nvm. i got it. thanks alot for your help!! Quote Link to comment https://forums.phpfreaks.com/topic/162500-solved-ignoring-symbols-in-query/#findComment-857696 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.