shlomikalfa Posted October 27, 2007 Share Posted October 27, 2007 hey there i've made a db to storge many posts however i can't seem to find out how to make that database's search case-insensitive, please help ... THANKS IN ADVANCE! Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/ Share on other sites More sharing options...
cooldude832 Posted October 27, 2007 Share Posted October 27, 2007 try the Like operator <?php $q = "select fields from `table` where fieldname like '".$value."'"; Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/#findComment-379441 Share on other sites More sharing options...
GingerRobot Posted October 27, 2007 Share Posted October 27, 2007 Mysql is ,by default, case insenstive. A standard comparison query (using the = sign) is case insenstive. You can make searches case senstive, however. See: http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/#findComment-379476 Share on other sites More sharing options...
shlomikalfa Posted October 28, 2007 Author Share Posted October 28, 2007 SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` = "My first dl" --============ SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` LIKE "My first dl" i need the Title to be case insensitive... in the ways above it is case-sensitive!!! anyone can help ? I'd like to add 1 more EZ question that might help me alot!!! - how do i get the latest indexed item from a certain table ?! (Currently i'm using a redicules method which is select... where 1, and the feching the row numbers.) THANKS IN ADVANCE !!! Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/#findComment-379956 Share on other sites More sharing options...
GingerRobot Posted October 28, 2007 Share Posted October 28, 2007 As the link i posted shows, you need to set the collation to one of the case senstive options. If you want all of your searches on that field to be case senstive, then modify the collation on the field. If you just want this particular query to be case sensitive, then try: SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE latin1_general_cs = "My first dl" Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/#findComment-379962 Share on other sites More sharing options...
shlomikalfa Posted October 28, 2007 Author Share Posted October 28, 2007 @GingerRobot dear mr.dude, i don't want case-sensitive !!! - i want case-IN-sensitive... how do i do that ? p.s - i've read the page you've gave me many times already - still no clue why do i need to read it as i don't want my searches case-sensitive BUT case-IN-sensitive... please help me sir. Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/#findComment-379965 Share on other sites More sharing options...
shlomikalfa Posted October 28, 2007 Author Share Posted October 28, 2007 why can't i edit my own post... bah - it's not a spam and sorry for the double post! SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE utf8_bin = "My first dl" -====== SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` = "My first dl" -====== SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` LIKE "My first dl" All of these give me no return! - 0 rows. {used directly on the mysql interface.} but all of the following do give me the requested entry!!! -. notice the M-m changes. SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE utf8_bin = "my first dl" -====== SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` = "my first dl" -====== SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` LIKE "my first dl" any idea anyone ?! already over 8 hours trying to figure it out.... Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/#findComment-379980 Share on other sites More sharing options...
GingerRobot Posted October 28, 2007 Share Posted October 28, 2007 Hmm, well looks like i misread. I can only assume that the field title has a case sensitive collation. Try this query: SELECT HIGH_PRIORITY * FROM downloads WHERE `downloads`.`Title` COLLATE utf8_general_ci = "my first dl" If that works, then modify the collation on the field. Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/#findComment-379994 Share on other sites More sharing options...
shlomikalfa Posted October 28, 2007 Author Share Posted October 28, 2007 THANKS !!! i'd never realize it on my own !!! Link to comment https://forums.phpfreaks.com/topic/75036-solved-run-a-mysql-select-quary-with-insensitive-case/#findComment-380022 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.