Jump to content

[SOLVED] Ignoring symbols in query


adrek

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/162500-solved-ignoring-symbols-in-query/
Share on other sites

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!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.