Ignoring Case



I have set up a simple search in PHP. The user enters some text and
this is then searched for in a MySQL database. If the text is found
within the database, the whole text is displayed, highlighting what the
user entered in red....

Basically...

User enters text in a text box. Result stored as textsearch.

//perform the search in the database
$sql = "select * from mytable where textfield like
'%$_POST[textsearch]%'";

//If found the result of the textfield is stored as $searchres,
changing all occurance of the user entered text to red

$searchres = str_replace("$_POST[textsearch]","<font
color=#FF0000><strong>$_POST[textsearch]</strong><font
color=#000000>",$searchres);

//$searchres is echo'ed

All this works great except if the textfield contains for example
'School' and the user searches on 'school' it won't find it.

I could use various function such as strtolower() etc and try all
possibilities but is there an easier way ignore the case so the search
with pick up both 'School' and 'school'?

Many Thanks

Mike

.



Relevant Pages

  • Re: MMcontrol wont work on transported source code
    ... >administer make-up tests to her high school French students. ... > I got the app to work at home using a dummy database. ... Made sure the MMcontrol is added to the project components at school ... filename of the MP3 is correct? ...
    (microsoft.public.vb.general.discussion)
  • Re: Ignoring Case
    ... this is then searched for in a MySQL database. ... 'School' and the user searches on 'school' it won't find it. ... Take a look at the Mysql LIKE String Comparison Function. ...
    (alt.php)
  • Re: C#.NET Project idea ??
    ... Well at the moment i dont have any clue how to use database from ... database for my reference. ... We have got our own school. ... project and i am a software engineering student. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Entering Check Boxes into Design View
    ... person in my database instead of just that one. ... linking a record to a sunday school database? ... lists of members, lists of activities (e.g. ... or envelopes, sends emails, etc. ...
    (microsoft.public.access.gettingstarted)
  • Re: HELLLLLLLLP!! I Screwed up!
    ... for me to pay out of my pocket for something for my school. ... could do it for a more reasonable price I would be happy to pay it. ... >Posting your database is completely inappropriate. ... >volunteers will help if they are willing and able to do so. ...
    (microsoft.public.access.gettingstarted)