How to query arrays-php Tutorial

Source: Internet
Author: User
How to query array id hot
1 1
2 9, 10, 11
3 30
4 19,20, 30
5, 30
6 11
8 10, 20, 30
9, 9, 20

How can I find the data with hot containing 1?

Final effect:
Id hot
1 1
5, 30
9, 9, 20


Reply to discussion (solution)

select * from tbl_name where find_in_set('1', hot)

Thank you very much!

select * from tbl_name where find_in_set('1', hot)


Do you need to compile the find_in_set function yourself!
0 rows are returned after execution.

Are you not mysql?


select * from tbl_name where find_in_set('1', hot)


Do you need to compile the find_in_set function yourself!
0 rows are returned after execution.



Does find_in_set need to be self-contained ?, Me ??? Rows are acceptable.




? The row returns 0. can you check whether the table exists ??.



select * from tbl_name where find_in_set('1', hot)


Do you need to compile the find_in_set function yourself!
0 rows are returned after execution.



Does find_in_set need to be self-contained ?, Me ??? Rows are acceptable.




? The row returns 0. can you check whether the table exists ??.


What is the type of the hot field when my data is stored incorrectly! Separated by commas




select * from tbl_name where find_in_set('1', hot)


Do you need to compile the find_in_set function yourself!
0 rows are returned after execution.



Does find_in_set need to be self-contained ?, Me ??? Rows are acceptable.




? The row returns 0. can you check whether the table exists ??.


What is the type of the hot field when my data is stored incorrectly! Separated by commas


I use varchar.

CREATE TABLE `hot` ( `id` int(10) unsigned NOT NULL auto_increment, `hot` varchar(200) NOT NULL, PRIMARY KEY  (`id`)) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1

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.