Jump to content
Sign in to follow this  

mysql-søkefunksjon, ikke skille store og små tegn

Recommended Posts

Har sitti å prøvd meg litt på mysql i dag/natt, begynt å få det ok til.


Problemet mitt er at jeg gjerne skulle ha laget søkefunksjonen slik at den ikke skiller mellom store og små bokstaver, slik at jeg kan søke på "hallo" men av like vell finne feltet som det står "HaLlO" som et eksempel.


Har brukt denne nå:

SELECT * FROM test WHERE tittel LIKE '%$ord%'


Noen som kunne hjelpe meg med å løse dette?

Share this post

Link to post

Når du bruker LIKE, så skiller ikke denne mellom store og små bokstaver som standard.


A.5.1. Case Sensitivity in Searches


By default, MySQL searches are not case sensitive (although there are some character sets that are never case insensitive, such as czech). This means that if you search with col_name LIKE 'a%', you get all column values that start with A or a. If you want to make this search case sensitive, make sure that one of the operands has a case sensitive or binary collation. For example, if you are comparing a column and a string that both have the latin1 character set, you can use the COLLATE operator to cause either operand to have the latin1_general_cs or latin1_bin collation.

Du kan lese hele regla her:


Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...