Im using the following php and mysql to extract rows from a table,
$search_word=$_GET['search_word'];
$search_word_new=mysql_escape_string($search_word);
$search_word_fix=str_replace(" ","%",$search_word_new);
$sql=mysql_query("SELECT * FROM tweets WHERE content LIKE '%$search_word_fix%' ORDER BY votes DESC LIMIT 20");
The 'content' field is a TEXT field containing tweets.
The problem is that if I search for " S tackoverflow", I get all the results containing "Stackoverflow", but no results if the text is " s tackoverflow". Basically, the search is case sensitive.
Is it possible to change the query or PHP, so when searching for "Stackoverflow" the results are returned with upper and lower case?
source
share