Case-insensitive LIKE in postgresql

wxdqz

New Member
I am having a small problem with a search function in postgresql 7.1 using the LIKE '%$searchvar%' string in the select. The problem is that whats inside the %% is case sensitive to the database. If I search for matt but the database has Matt, I get no results. Currently I am using a klunky method to get around this:

$searchin[0] = explode(" ", ucwords(strtolower(addslashes($search))));
$searchin[1] = explode(" ", strtolower(addslashes($search)));
$searchin[2] = explode(" ", strtoupper(addslashes($search)));

This creates a huge variable with all the possibilities, but makes 3x the work that the database has to do when I feed it in to create the query with all the fields it looks in.

Is there a way to simply turn off the case-sensitivity?

-Matt
 
Back
Top