PHP搜索写法 请
求助PHP搜索写法 请高手指点!
A表、B表字段均为数字类字符串:如‘2,3,6,34,23’、‘43,23,8,35’。。。。
现在要用A表字段去搜索B表,请高手指点下
开始是把A字段打成数组去likeB字段,结果发现不行,如果A字段里有3,那么B字段里23,33,43。。。带3的都会被检索。
所以求更好的解决方法!
------解决方案--------------------
like '2,'
------解决方案--------------------
你保存数据时,前后都一定要带有 ,
构造成这样:,2,,4,
然后你就用 like ',3,'
------解决方案--------------------
把A字段打成数组去 like B字段
是不行的,原因你也知道了
但是 把A字段打成数组 是对的
比较时用 find_in_set 就行了
比如
find_in_set('3','23,33,43')
就不会匹配到

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

With the continuous development of internationalization, more and more websites and applications need to support multi-language switching functions. As a popular front-end framework, Vue provides a plug-in called i18n that can help us achieve multi-language switching. This article will introduce common techniques for using i18n to implement multi-language switching in Vue. Step 1: Install the i18n plug-in First, we need to install the i18n plug-in using npm or yarn. Enter the following command at the command line: npminst

The out interface refers to the output interface, and the in interface refers to the input interface. The out interface generally represents the audio source line output interface, which is used to connect loads, such as speakers, headphones, etc.; while the in interface generally represents the audio source line input interface, which is used to connect CD players, mobile phones, MP3 players, computers, etc.

In this fast-paced era, OPPO Find X7 can use its imaging power to let us savor every beautiful moment in life. Whether it's magnificent mountains, rivers, lakes, or seas, warm family gatherings, or encounters and surprises on the street, it can help you record them with "unparalleled" picture quality. From the outside, the camera Deco design of Find It looks very recognizable and has a high-end feel. The inside is also unique, starting with the basic hardware configuration. FindX7 maintains the previous

On August 22, a digital blogger revealed some core configuration information of OPPO Find X8 Ultra. According to the exposed content, this high-end model will be equipped with Qualcomm’s latest Snapdragon 8Gen4 mobile platform, equipped with a 6000mAh ultra-large capacity battery, and supports 100W wired fast charging and 50W wireless fast charging functions. Appearance design There is currently no specific design information about OPPO Find X8 Ultra. But the real picture of the standard version of OPPO Find X8 has been exposed on the Internet. Appearance of FindX8 Judging from the exposed photos, the rear camera module of OPPO FindX8 adopts a square design with a certain degree of curvature at the four corners, giving a more rounded feeling. In addition, the machine adopts a direct

What are the string search and replace techniques in Python? (Specific code example) In Python, strings are a common data type, and we often encounter string search and replace operations in daily programming. This article will introduce some common string search and replacement techniques, accompanied by specific code examples. To find a specific substring in a string, you can use the find() method or index() method of the string. The find() method returns the index of the first occurrence of the substring in the string.

Methods to delete elements: 1. Use delete() to delete the specified element from the Set object, the syntax is "setObj.delete(value);"; 2. Use clear() to delete all elements in the Set object, the syntax is "setObj.delete(value);" "setObj.clear();".

1. The difference in matching content. LIKE requires that the entire data must be matched. With Like, all the contents of this field must meet the conditions; REGEXP only requires partial matching, and only one fragment needs to be satisfied. 2. Differences in matching positions: LIKE matches the entire column. If the matched text appears in the column value, LIKE will not find it and the corresponding row will not be returned (unless wildcards are used); REGEXP is within the column value. A match is performed. If the matched text appears in the column value, REGEXP will find it, the corresponding row will be returned, and REGEXP can match the entire column value (same effect as LIKE). 3. The SQL statement returns data that differs from LIKE matching: the SQL statement
