Skip navigation links

MySQL Forums :: PHP :: LIKE not working with simple search


Advanced Search

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


Subject Written By Posted
LIKE not working with simple search R G 04/28/2009 09:05AM
Re: LIKE not working with simple search Scotty Miller 04/29/2009 03:15AM


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.