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

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.