Jump to content

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

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.