How to extract words separated by | from the database! Such as the title: I write keywords into the database, often separated by |. When I extract and search for related articles, how do I extract the text separated by |, so that I can use keywords to search?
reply:
Copy the code code as follows:
<script language=vbscript>
dim keywords,operator,operend,strsql
keywords=clothing|lotus|famous brands|China
strsql = select * from table_name where
operator= title LIKE '%
operand=%'
keywords=Join(Split(keywords,|),operend & OR & operator)
document.write strsql & operator & keywords & operend
</script>
Usage of this query:
When adding data records, you can write multiple keywords. Keywords are separated by |. Of course, other characters can also be used, so you need to modify the relevant code. Finally, the relevant records can be queried based on the generated SQL statement.