mysql多个关键字的查询解决思路
mysql多个关键字的查询
- PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$list=""; $car = array('name'=>array(0=>array('xm'=>'我是特别的'),1=>array('xm'=>'你好'), 2=>array('xm'=>'你好'), 3=>array('xm'=>'你好'))); if(!$car['name']){ $list='Nothing'; }else{ $i = 1; foreach($car['name'] as $nm) { if(strstr($list,$nm['xm']) && $i == 1) { $list = str_replace($nm['xm'],$nm['xm'].$i,$list); $list .= $nm['xm'].($i+1).','; $i++; }else{ if(strstr($list,$nm['xm'])) { $list .= $nm['xm'].($i+1); $i++; }else{ $list .= $nm['xm'].','; } } } }
- SQL code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$sql="SELECT * FROM table where table.title in ('$list') limit 0,10";
php输出:我是特别的,你好1,你好2,你好3
mysql查询语句应该怎样写可以使$list生效?或者其他相同效果的查询方法?
新手麻烦各位尽可能的写得详细一些,谢谢。
------解决方案--------------------
你有
$sql="SELECT * FROM table where table.title in ($list) limit 0,10";
我让你贴出
echo $sql;
的结果!拿到就那么难吗?

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

List operation //Insert a value from the head of the list. $ret=$redis->lPush('city','guangzhou');//Insert a value from the end of the list. $ret=$redis->rPush('city','guangzhou');//Get the elements in the specified range of the list. 0 represents the first element of the list, -1 represents the last element, and -2 represents the penultimate element. $ret=$redis->l

Title: Example of using the Array.Sort function to sort an array in C# Text: In C#, array is a commonly used data structure, and it is often necessary to sort the array. C# provides the Array class, which has the Sort method to conveniently sort arrays. This article will demonstrate how to use the Array.Sort function in C# to sort an array and provide specific code examples. First, we need to understand the basic usage of the Array.Sort function. Array.So

Both are true wireless headphones released by Sony. If we want to buy them, how do we choose between Sony linkbuds and xm4? In fact, their positioning is completely different. One focuses on appearance design, and the other focuses on noise reduction. How to choose between Sony linkbuds and xm4: Answer: Sony linkbuds and xm4 are two completely different headphones. If you like the compact appearance and personalized design, choose linkbuds. Friends who need powerful active noise reduction headphones are recommended to choose xm4. Comparison between Sony linkbuds and xm4: 1. First of all, linkbuds is an indoor headset with almost no noise reduction ability. 2. The WF-1000XM4 has professional multi-level noise reduction capabilities, which is almost the strongest in the same price range.

1: JSONArray to ListJSONArray string to List//Initialize JSONArrayJSONArrayarray=newJSONArray();array.add(0,"a");array.add(1,"b");array.add(2,"c") ;Listlist=JSONObject.parseArray(array.toJSONString(),String.class);System.out.println(list.to

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

Method to convert xm to mp3 format: 1. Open the "Format Factory" software and click the "Add File" button on the mp3 function interface; 2. In the opened interface, double-click the xm file in the file manager; 3. Click " Start" button to convert to mp3 format.

How to sort a list using the List.Sort function in C# In the C# programming language, we often need to sort the list. The Sort function of the List class is a powerful tool designed for this purpose. This article will introduce how to use the List.Sort function in C# to sort a list, and provide specific code examples to help readers better understand and apply this function. The List.Sort function is a member function of the List class, used to sort elements in the list. This function receives

1. Introduction to List interface List is an ordered collection and a repeatable collection. It inherits the Collection interface. Repeated elements can appear in the List collection, and the element at the specified position can be accessed through the index (subscript). 2. List common methods - voidadd (intindex, Obejctelement) method 1. The voidadd (intindex, Obejctelement) method inserts the element element at the specified position and moves the subsequent element back one element. 2.voidadd(intindex,Obejctelemen
