Jump to content

Recommended Posts

Hello all... I am currently using mysql match against for a search on my website, yes i know thats the lazy way but thats all i really need right now.... I am having an issue where it can find anything that has a dash in it. For example TL-100 but it would find TL100 just fine... Any ideas on how i could get it to recognize the dash?

 

Thanks!!

Link to comment
https://forums.phpfreaks.com/topic/114598-solved-mysql-match-against/
Share on other sites

stab in the dark, I dont really understand what you are doing but try running a variable containing TL-100 through

addslashes()

or

mysql_real_escape_string()

 

that should escape the input so that mysql recognizes the dash as a literal dash and not a minus or whatever - equates to in sql

sql does not get confused by dash marks if it's wrapped in quotes as a string, which I'm assuming his data is: a string type. 

 

As far as the question goes: be more specific. 

 

Are you wanting to select all data that has a dash in it?  Are you wanting it to be able to find TL-100 whether it has a dash in it or not, as in, you want sql to see TL100 and TL-100 as the same thing? 

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.