jj20051 Posted March 1, 2009 Share Posted March 1, 2009 I have a script setup that searches through a database of links. The problem is that if you type 'google' in nothing comes up, but if you type 'Google' in results come up. The title of the pages in the database all have a capital G at the beginning. Bellow are the two links: http://apenex.net/search.php?search=google http://apenex.net/search.php?search=Google Here is the query I'm using: $search = "`keywords` LIKE '%{$keyword}%' OR `title` LIKE '%{$keyword}%' OR `description` LIKE '%{$keyword}%' OR `sample` LIKE '%{$keyword}%'"; $query = "SELECT COUNT(*) as num FROM sites WHERE {$search} ORDER BY totalrating DESC"; If you have an idea, that would be great. I tried using the strtolower() function, but there was no result. I could make the whole database lowercase, but that would take a while. Link to comment https://forums.phpfreaks.com/topic/147387-solved-php-uppercase-and-lower-case-problems-when-using-the-like-function/ Share on other sites More sharing options...
jj20051 Posted March 1, 2009 Author Share Posted March 1, 2009 Apparently you can fix this by changing the table type. In my case I has it set to utf8_bin, whe i changed it to utf8_general_ci as instructed by a friend it began working. Link to comment https://forums.phpfreaks.com/topic/147387-solved-php-uppercase-and-lower-case-problems-when-using-the-like-function/#findComment-773625 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.