多个搜索参数 [英] Multiple Search Parameters

查看:95
本文介绍了多个搜索参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Howdy,

我正在开发一个系统,我需要一个基本的HTML表单来将数据传递到cfm页面。然后,cfm页面将查询数据库并返回任何匹配的数据。我正在使用MySQL。


我的HTML页面上有一个表单元素,允许用户输入搜索条件。当他们单击提交时,它会将文本字段中的数据发送到coldfusion页面,该页面通过对数据库的查询来运行该数据。如果找到匹配项,则应显示结果数据。表单有效,它将完整的请求发送到coldfusion页面没有问题。唯一的问题是当你输入多个单词时,即使这两个单词都在数据库中,它也不会返回任何记录。我想知道是否有人对如何解决这个问题有任何想法,我想某种方式将输入字符串分成几部分并单独运行每个部分,我只是不知道该怎么做。


这是HTML表单代码。

Howdy,
I am working on a system where I need a basic HTML form to pass data to a cfm page. The cfm page will then query a database and return any matching data. I am using MySQL.

I have my HTML page with a form element that allows a user to enter search criteria. When they click submit it sends the data in the text field to a coldfusion page that runs that data through a query to the database. If a match is found it should display the resulting data. The form works, it sends the complete request to the coldfusion page with no problem. The only problem is that when you enter more than one word, even if both of those words are in the database, it doesn''t return any records. I''m wondering if anyone has any ideas on how to fix this, I was thinking of somehow breaking the input string into parts and running each individual part by itself, I''m just not sure how to do that.

Here is the HTML form code.

展开 | 选择 | Wrap | 行号

推荐答案

欢迎来到TSDN!


所以你想拆分字符串并搜索string1或string2,即如果string1或string2出现在记录中,它应该在搜索中返回? (不是string1和string2)
Welcome to TSDN!

So you want to split the string and search for string1 or string2, i.e. if string1 or string2 appears in a record, it should be returned in the search? (not string1 AND string2)



欢迎来到TSDN!


所以你想拆分字符串并搜索string1或string2,即如果string1或string2出现在记录中,它应该在搜索中返回? (不是string1和string2)
Welcome to TSDN!

So you want to split the string and search for string1 or string2, i.e. if string1 or string2 appears in a record, it should be returned in the search? (not string1 AND string2)



我实际上希望它搜索string1和string2。我只是不确定将其拆分并让每个部分都通过查询的最佳方法。分裂字符串是我遇到的最大问题。

I actually would like it to search for string1 AND string2. I''m just not sure of the best way to split it up and have each part run through a query. The splitting of the string is the biggest problem I am having.



我实际上希望它搜索string1 AND string2。我只是不确定将其拆分并让每个部分都通过查询的最佳方法。弦的分裂是我遇到的最大问题。
I actually would like it to search for string1 AND string2. I''m just not sure of the best way to split it up and have each part run through a query. The splitting of the string is the biggest problem I am having.



我实际上找到了帮助我的东西。我将查询更改为:

I actually found something out that helped me. I changed my query to this:

展开 | 选择 | Wrap | 行号


这篇关于多个搜索参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆