搜索数据库 [英] search database
本文介绍了搜索数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我对此很新,并尝试用多个问题搜索我的数据库并返回确切的答案,而不是在查询中列出所有内容,即如果我搜索蓝色大众高尔夫球我想让它返回所有的蓝色大众高尔夫而不是所有的大众'',所有的蓝色'和所有的高尔夫球'。任何人都可以帮忙吗?
Steve
解决方案
MySQL允许你在你里面使用''AND''或''OR ''在哪里''论点。
你的陈述看起来像:
展开 | 选择 | 换行 | 行号
谢谢你,但是如果我想要一个红色的话,我还需要放一个,我是否必须保持重复相同的字符串?
你是从用户那里搜索的可访问的形式?
如果它位于网络的后端迭代,你可以让自己成为一个有两个选择框的表单。选择框的选项可以是颜色的可用选项,并且您希望提供。例如:
------- FORM -------
选择你的作品:_______________
| _选择1:VW
| _选择2:克莱斯勒
| _选择3:等等...
选择你的颜色:_______________
| _选择1:蓝色
| _选择2:黑色
| _选项3:等...
-----结束表格-----
然后根据用户输入的选项编译你的MySQL语句。 />
展开 | 选择 | Wrap | Line编号跨度>
Hi
I am fairley new at this, and trying to search my database with mutiple questions and to return the exact answer instead of listing everything in the query, ie if I search for blue vw golf I want it to return all the blue vw golf not all the vw'', all the blue''s and all the golf''s. Can anyone help ?
Steve解决方案MySQL allows you to use ''AND'' or ''OR within you ''WHERE'' argument.
Your statement would look something like:
Expand|Select|Wrap|Line Numbers
thank you, but what would i have to put if i wanted a red one, would i have to keep duplicating same string ?
Are you searching from a user accessible form?
If it''s on a back-end of a website, you could just make yourself a form that has two ''select'' boxes. The options of the select box could be the available options of colors and makes you want to offer. Example:
-------FORM-------
Choose your Make: _______________
|_Option 1: VW
|_Option 2: Chrysler
|_Option 3: Etc...
Choose your Color: _______________
|_Option 1: Blue
|_Option 2: Black
|_Option 3: Etc...
-----END FORM-----
Then compile your MySQL statement based on the selections the user has put in.
Expand|Select|Wrap|Line Numbers
这篇关于搜索数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆