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 219391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:50:25+00:00 2026-05-11T18:50:25+00:00

I use a very simple query with Like to find product by its name

  • 0

I use a very simple query with “Like” to find product by its name

SELECT p_pid, p_name, p_cat
FROM products
WHERE p_sid=346 AND p_name LIKE 'product name here in utf-8 encoding, can be various languages'
LIMIT 1

When I run this query from code with valid product name, I get no results. If I copy the query (echoed by php to the browser) and run it manually in mysql query browser I do get a result. Any idea where I’m wrong?

Notes:

1.There is no error coming from the query. Just no results.
2. I’m using ezsql library
3. The code runs well and perform other SELECTs with the database successfully in the same scope in the code.

  • 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-11T18:50:25+00:00Added an answer on May 11, 2026 at 6:50 pm

    Seems to be the issue with encoding.

    Try running this query:

    SELECT HEX(CAST('product name here in utf-8 encoding, can be various languages' AS BINARY))
    

    both in ezSQL and in the query browser and compare the results.

    This will give you binary stream that MySQL really gets from your client and uses in comparison.

    If you set wrong connection encoding in ezSQL properties, the string may get mangled (like, question marks instead of UTF symbols).

    In this case comparison will of course fail.

    Update:

    Try to force case insensitive collation:

    SELECT  *
    FROM    table
    WHERE   field LIKE 'product name here in utf-8 encoding, can be various languages' COLLATE UTF8_GENERAL_CI
    

    Also, could you please post binary dump both of your string and the data contained in the field?

    SELECT  p_pid, p_name, p_cat,
            HEX(CAST(p_name AS BINARY)),
            HEX(CAST('product name here in utf-8 encoding, can be various languages' AS BINARY))
    FROM    products
    WHERE   p_pid = @pid_of_product_that_should_match_but_it_doesnt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a simple mysql LIKE query like this: SELECT * FROM myTable WHERE
For a very simple profiling I use microtime() like this: $now = microtime(); for
I want to bind the variables in a query like this: SELECT people.name, conf.id
I'm doing a very simple YQL statement: select * from xml where url=http://www.wowhead.com/item=50278&xml The
I need to use or stimulate a very simple session object inside my WCF
I've developed a very simple host and client which I wanted to use to
I want to use the Django admin interface for a very simple web application
I try to use the client side validation on a very simple example and
I’m trying to use Waypoints to do a very simple scrolling effect, but for
I'm writing a very simple and small wrapper around sqlite3, and use sqlite3_get_table() to

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.