MySQL Forums
Forum List  »  PHP

LIKE not working with simple search
Posted by: R G
Date: April 28, 2009 09:05AM

I'm trying to do a simple search script. I've assigned a variable the value of the submitted search:

$q = $_REQUEST['q'];

Then, I strip tags, trim, and set the string to uppercase to take care of case-sensitive searches.

$q = trim($q);
$q = strip_tags($q);
$q = strtoupper($q);

Then, I try to do the search:

mysql_query("SELECT * FROM tablename WHERE UPPER(description) LIKE '%$q%' ");

And I get no results returned even though I do a very simple, one-word search that is found in many records in the table.

And to confound things even more, I'll do a separate search in a different fieldname that DOES work...

mysql_query("SELECT * FROM tablename WHERE UPPER(title) LIKE '%$q%' ");

Now, the title field is a varchar field and the description field is a BLOB field. Is that a problem?

What do you think I'm doing wrong? Do I need to submit more information? Please help. Thanks.

Options: ReplyQuote

Written By
LIKE not working with simple search
April 28, 2009 09:05AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.