Jump to content

Apostrophe in blob


mh

Recommended Posts

Hi everyone,

I'm trying to write a code to perform a search on a website. The code that I wrote works perfectly when I try to search in a 'varchar' column => (it give correct result for words containing apostrophe and not containing apostrophe). However, if I try to search in a 'blob' column, I only get correct result for words not containing apostrophe.

PS: I'm using the : mysql_real_escape_string

 

can anyone help? thx in advance!

Link to comment
https://forums.phpfreaks.com/topic/83345-apostrophe-in-blob/
Share on other sites

Could you show a sample of your code please?

 

You've shown that your using => but as far as i know that would only return a true result on numeric fields.. (maby i will learn somthing new.)

 

If yous looking inside a blob you would generally use

 

"SELECT FROM * WHERE field LIKE '%".$_POST['formfield']."%'"

 

Regards

Liam

Link to comment
https://forums.phpfreaks.com/topic/83345-apostrophe-in-blob/#findComment-424025
Share on other sites

no i'm not using ' => ' in my code, I just wrote it here so i can explain what i mean by saying "it works perfectly". This is a sample of my code:

$keyword = mysql_real_escape_string($keyword);

$query="SELECT ID FROM Articles WHERE $columname LIKE '%$keyword %' ;

 

where $keyword is the word that I'm searching for. If $columname, is a varchar, than everything works fine. But if it's a blob then it only works when $keyword contains no apostrophe.

 

thx for ur reply

Link to comment
https://forums.phpfreaks.com/topic/83345-apostrophe-in-blob/#findComment-424032
Share on other sites

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.