For PHP search instructions, please advise! Fields in Table A and Table B are numeric strings, for example, '2, 3, 6, 34, 23', '43, 35 '.... Now, we need to search for Table B using the table A field. if the field A is converted into an array and the likeB field is not found, if there is 3 in field, in field B, you can ask for PHP search instructions!
Fields in Table A and Table B are numeric strings, for example, '2, 3, 6, 34, 23', '43, 35 '....
Search for Table B using the table A field.
At first, we typed field a into an array and went to the likeB field. The result showed no. if field A contains 3, then field B contains, 33, and 43... All with 3 will be retrieved.
Therefore, a better solution is required!
------ Solution --------------------
Like '2 ,'
------ Solution --------------------
When you save the data, you must include,
Constructed as follows:, 2, 4,
Then you can use like ', 3 ,'
------ Solution --------------------
Compress field A into an array and remove field like B.
No, you know why.
However, it is correct to compress field A into an array.
Use find_in_set for comparison.
For example
Find_in_set ('3', '23, 33,43 ')
It won't match
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.