database query, query numbers or English can, query Chinese error

Source: Internet
Author: User

database query, query the number or English can, query Chinese error: Prompt????????????: SELECT * from Szdbdb_userdata where truename= '???? '

Illegal mix of collations (gb2312_chinese_ci,implicit) and (latin1_swedish_ci,coercible) for operation ' = ' 12670

Workaround: The general online will say is the encoding problem, in the configuration file My.ini modify the database encoding. When all encodings are set to be consistent, this consideration is what is chosen when the database is established. Open the database to see. If it's different, you'll have to rebuild the database. Also check the query code.

$sql = "Select * FROM {$pre}userdata where truename= ' $stext '";

$d 1= $db->query ($sql);

$num =mysql_num_rows ($d 1);

Switch

$query 1=mysql_query ("select * from {$pre}userdata where truename= ' $stext '");

$num =mysql_num_rows ($query 1);

This may be because $d1= $db->query ($sql) and transcoding causes errors.

database query, query numbers or English can, query Chinese error

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.