Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.