shocker-z Posted October 29, 2006 Share Posted October 29, 2006 Hi all,Long time no POST (New job busy and all)Just doing a small script for my work and i've come across a script that seems to be case sensitive, yet in my database the field is set as case insensitive??Here is my code:[code]<?php$clientsearch=mysql_real_escape_string($_POST['clientname']);$searchtype=mysql_real_escape_string($_POST['searchtype']);if ($searchtype == 'start') { $searchfor="$clientsearch%";}if ($searchtype == 'end') { $searchfor="%$clientsearch";}if ($searchtype == 'any') { $searchfor="%$clientsearch%";}$getclients=mysql_query("SELECT client, ID FROM clients WHERE client LIKE '$searchfor' ORDER BY client ASC");while ($client=mysql_fetch_array($getclients)) { echo "<option value=\"$client[ID]\" >$client[client]</option>";}?>[/code]Any idea's?RegardsLiam Wheldon Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/ Share on other sites More sharing options...
ignace Posted October 29, 2006 Share Posted October 29, 2006 the problem may lie in the use of mysql_real_escape_string(); I however never use this function cause whenever i use this, the whole script does not work, mostly because the before mentioned function "real" escaped everything leaving nothing to return :D Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116329 Share on other sites More sharing options...
shocker-z Posted October 29, 2006 Author Share Posted October 29, 2006 nice try that i didnt think about but nope.. still the same :(Any other idea's? Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116390 Share on other sites More sharing options...
Barand Posted October 29, 2006 Share Posted October 29, 2006 This may helphttp://dev.mysql.com/doc/refman/4.1/en/case-sensitivity.html Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116412 Share on other sites More sharing options...
shocker-z Posted October 29, 2006 Author Share Posted October 29, 2006 hmm that seems to be all about making case sensitive searches not making something search case insensitive...Might be missing somthing but i read the page 3 times...Anything extra?HMMM just tryed excecuting the code outside of PHP and i get the same results.. it's searching case sensitive!any idea's on the mysql side? Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116421 Share on other sites More sharing options...
Barand Posted October 29, 2006 Share Posted October 29, 2006 I says they are case-insensitive by default, so make sure you [b]haven't[/b] done any of those things that could make it case-sensitive Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116424 Share on other sites More sharing options...
shocker-z Posted October 29, 2006 Author Share Posted October 29, 2006 here's my table if it helps??CREATE TABLE `clients` ( `ID` int(11) NOT NULL auto_increment, `client` varchar(35) default NULL, `abr` varchar(35) default NULL, `addr1` varchar(100) default NULL, `addr2` varchar(100) default NULL, `addr3` varchar(100) default NULL, `addr4` varchar(100) default NULL, `postcode` varchar(10) default NULL, PRIMARY KEY (`ID`)) ENGINE=MyISAM AUTO_INCREMENT=199 DEFAULT CHARSET=latin1;Thanks for the help :) Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116429 Share on other sites More sharing options...
Barand Posted October 29, 2006 Share Posted October 29, 2006 My searches on the client column with that definition are case-insensitive. Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116436 Share on other sites More sharing options...
shocker-z Posted October 29, 2006 Author Share Posted October 29, 2006 Hmm.. all fields :Stryed on another table and working now on them so will recreate table..EDIT:OK!!! I give up has someone spiked my Milkshake because after testing same code on another table and changing back it's now working!!! :D suppose that's a good thing ceopt i made no changes!!! :SThanks for the help :)Liam Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116446 Share on other sites More sharing options...
fenway Posted October 29, 2006 Share Posted October 29, 2006 Very strange symptoms... but you have it working now, yes? Quote Link to comment https://forums.phpfreaks.com/topic/25497-case-insensitive-but-sending-case-sensitive/#findComment-116461 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.