Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3285676
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:17:37+00:00 2026-05-17T20:17:37+00:00

For example if I search for the name Åsa i only want to get

  • 0

For example if I search for the name Åsa i only want to get the name Åsa and not Asa, same with Björn instead of Bjorn

$query="select * from users where username like 'Björn'";
$result=mysql_query($query);
$num=mysql_num_rows($result);
echo"$num";
$i=0;
while($i<$num){     
$id=mysql_result($result,$i,"id");
$name=mysql_result($result,$i,"username");    
echo"<br/>$id,$name";
$i++;
}

Results

34,Björn
67,Bjorn

only result 34 is supposed to be displayed
I am using

mysql_query("SET NAMES utf8");
mysql_query( "SET CHARACTER SET utf8");

The database, table and column are set to utf8_unicode_ci

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:17:37+00:00Added an answer on May 17, 2026 at 8:17 pm

    Your “problem” is the utf8_unicode_ci collation. That collation does “character expansions”, meaning that Umlauts and their base characters are treated as the same even in a = comparison:

    A = Ä
    O = Ö
    ...
    

    The second example on this mySQL manual page explains the issue: 9.1.7.8. Examples of the Effect of Collation

    What you would have to do is either switch to a collation that distinguishes between umlaut and base character (e.g. utf8_general_ci or utf8_general_bin) or switch to a different collation only when doing the comparison:

    select * from users where username like 'Björn' COLLATE utf8_general_ci;
    

    this is obviously slower, because the collation conversion has to be done for each record during the query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, the users of our app want to search products by entering a
I want my search to only display results that match values in the same
The Mongoid documentation only gives one example of doing a wildcard search: Person.where(first_name: /^d/i)
In this example below: my $rs = $schema->resultset('CD')->search( { 'artist.name' => 'Bob Marley' 'liner_notes.notes'
Example: the user fills in everything but the product name. I need to search
Suppose I was given a URL. It might already have GET parameters (e.g. http://example.com/search?q=question
For invoke search android example, every time query search result is received by onCreate().
For example, I want to search a word ' marple ', this should return
I want to make a php search query. First, I put a sentence and
I want to manipulate a URL to get just the base site name. For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.