in reply to MySQL Like Statement and case sensitivity

You're testing for description being logically true and longdescription matching whatever $search looks like. To get a case-insensitive match, you could transform everything to one case with UPPER(), say. Use placeholders.

$sth = $dbh->prepare( "SELECT * FROM `items` WHERE UPPER(description) LIKE UPPER(?) OR UPPER(longdescription) LIKE UPPER(?)"); $sth->execute($search,$search) or die $dbh->errstr;

You should consider listing the columns you want, instead of using the wildcard. That way you don't fetch unneeded data, and can control the order of results.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: MySQL Like Statement and case sensitivity
by andrew (Acolyte) on Sep 06, 2002 at 21:51 UTC
    oops I ment case sensitive and if descrtion conatins "blalala ahaha aa" and the user puts "ah" in search that should come up!