Plus like fuzzy query conditions can not output, add points

Source: Internet
Author: User
Plus like fuzzy query conditions can not output, such as online!! Extra points

$conn = mysql_connect ("localhost", "root", "");
if (! $conn) {
Die ("Connection Database failed:". Mysql_error ());
} else {
echo "Connect to the database successfully!" ";
}
mysql_query ("Set character set UTF8");

$yes =mysql_select_db ("ORG7188", $conn);
if (! $yes) {
Die ("Connection Database failed:");
} else {
echo "Connect to the database successfully!" ";
}
$sql = "SELECT * from 188_line where TS like '% sanxia% '"; You can output content without a where statement
$socre =mysql_query ($sql, $conn);

while ($row = Mysql_fetch_array ($socre)) {
echo $row [TS];

}

?>

The database is as follows



------Solution--------------------

SELECT * FROM table where filds like binary \ '% Chinese%\ '
------Solution--------------------
What is the code for PHP? Code, database, browser Unified for Utf-8.
------Solution--------------------
Look at this.
....

$sql = "SELECT * from 188_line where TS like '% sanxia% '"; You can output content without a where statement
Die (Base64_encode ($sql)); Add the sentence and put the result

$socre =mysql_query ($sql, $conn);

------Solution--------------------
In MySQL, the sorting and finding results of Chinese characters are wrong when sorting and searching in the same language.
This situation is present in many versions of MySQL. If this problem is not resolved, then MySQL will not be able to actually handle Chinese.

This problem occurs because MySQL is case insensitive when querying strings, and when Yi MySQL is generally used as the default character set for the ISO-8859 character set, this behavior is caused by the Chinese encoding character-case conversion during comparison.

Method One:
The workaround is to add a \ "Binary\" property to the field that contains the Chinese, making it a binary comparison, for example, "name char (10) \", or "name Char (Ten) binary\".
Method Two: If you use the source code to compile MySQL, you can compile MySQL using the--WITH--CHARSET=GBK parameter, so that MySQL will directly support the Chinese search and sorting
------Solution--------------------
Explore

Reference:
Look at this.
....

$sql = "SELECT * from 188_line where TS like '% sanxia% '"; You can output content without a where statement
Die (Base64_encode ($sql)); Add the sentence and put the result

$socre =mysql_query ($sql, $conn);



Error syntax err ...

------Solution--------------------
discuss

Should be the landlord PHP file encoding is not utf-8
  • 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.