Jump to content

[SOLVED] MYSQL Match against


vicodin

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

Link to comment
Share on other sites

The things is i need the - cause some of the products names have a - in them... ill probably just put in so it takes the - out but just wondering if there was a way to keep the - in there and have it search able.

Link to comment
Share on other sites

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? 

Link to comment
Share on other sites

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.