zoukankan      html  css  js  c++  java
  • 利用Split函数进行多关键字检索

    主题: 怎样提取数据库用|隔开的字!
    如题:我写入关键字到数据库,多的时候用|隔开了,我提取再做相关文章搜索的时候,我怎么提取用|隔开的文字啊,这样我就好用关键字做搜索啊
    回复:

    <script language="vbscript">
    dim keywords,operator,operend,strsql
    keywords="服装|荷花|名牌|中国"
    strsql = "select * from table_name where"
    operator=" title LIKE '%"
    operend="%'"
    keywords=Join(Split(keywords,"|"),operend & " OR " & operator)
    document.write strsql & operator & keywords & operend
    </script>
    该查询的用法:
    在添加数据记录时可写入多个关键字,关键字与关键字之间用"|"隔开,当然也可以用其它字符,这样就需要修改一下相关的代码了。最后根据所产生的SQL语句即可查询出相关的记录

  • 相关阅读:
    API
    Object constructor
    function()
    For语句的衍生对象
    编程语言发展史
    将Paul替换成Ringo
    Document.write和 getElementById(ID)
    姓名,电话号码,邮箱的正则检测
    JavaScript-BOM与DOM
    管理心得
  • 原文地址:https://www.cnblogs.com/zerogo/p/2209114.html
Copyright © 2011-2022 走看看