A strange problem: the same SQL statement can be found in mysql, but cannot be found in php.

Source: Internet
Author: User
A very strange problem: the same SQL statement can be found in mysql, but cannot be found in php as follows:
Data table structure in mysql:


SQL statement:
Select id from tradeDetails WHERE userName = 'Lily' AND goodsID = '1'

Php code:
 


When I put the SQL statement in mysql, one record can be found, but the record cannot be found during php page execution. .


Reply to discussion (solution)

Mysql_query ("set names utf8 ");

Php files are also UTF-8 encoded.

Php files are UTF-8 encoded.

The first two positive solutions, Hey, should be encoding problems...

Thank you! At the prompt of the moderator on the first floor, I found that my code was wrong and changed UTF-8 to utf8! Not much. I just divided it out on average.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.