February 10, 201214 yr Hello, I am using the mysql in boolean mode for the boolean search on a website but there is a slight problem, when i search "good" for example it will only find "good" in the fields its searching in, so if someone put "Good" on the profile then it wouldnt find them because its got a capital letter how can i do it so its not case sensitive? anyhelp would be great Gary
February 10, 201214 yr Hello, I am using the mysql in boolean mode for the boolean search on a website but there is a slight problem, when i search "good" for example it will only find "good" in the fields its searching in, so if someone put "Good" on the profile then it wouldnt find them because its got a capital letter how can i do it so its not case sensitive? anyhelp would be great Gary Make search strings lower case using strtolower, or make ur own function to do this function make_lower($a){ $upper = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P"); $lower = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p"); return str_replace($upper,$lower,$a); } does not have all the letters in my example but like i said just an example Edited February 10, 201214 yr by webdesigner93
February 11, 201214 yr Just use strtolower(). $string = 'Good'; echo strtolower($string); // returns good
February 12, 201214 yr http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html You can use MySQL LOWER('My String') function in your query. @webdesigner93 - you can use range() to generate character arrays foreach (range('a', 'z') as $letter) { echo $letter; }
Create an account or sign in to comment