Occasionally I flipped through a post I posted on the classic forum and thought that many friends might write about this, so I turned it over.
Topic: How to extract the database with | separated words!
As the title: I write keywords to the database, and I use | to separate them when I extract and search for related articles. How can I extract | separated words? This way I can use keywords to search
reply:
<scriptlanguage="vbscript">
dimkeywords, operator, operator, strsql
keywords="Clothing|Lotus|Famous Brand|China"
strsql="select*fromtable_namewhere"
operator="titleLIKE'%"
operand="%'"
keywords=Join(Split(keywords,"|"),operend&"OR"&operator)
document.writestrsql&operator&keywords&operend
</script>
Usage of this query:
When adding data records, multiple keywords can be written, separated by "|" between the keywords, and of course other characters can be used, so you need to modify the relevant code. Finally, the relevant records can be found based on the generated SQL statement.