C
C
chelovek_rediska2017-01-06 21:48:45
MySQL
chelovek_rediska, 2017-01-06 21:48:45

How to do a MySQL search in a table by parameter?

There is a procedure at which input parameter Word.
You need to make a selection in the states table by this parameter with any letters on the sides.
SELECT html from states where tags like '%word%';
The search is carried out exactly as by the word word, and not by the value of this parameter. You need to match the parameter with the "%" sign.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Rsa97, 2017-01-06
@chelovek_rediska

CONCAT()

R
Roman Mirilaczvili, 2017-01-06
@2ord

Well, if word is a parameter, then replace the substring with the value of the word parameter.
In many languages, this is done by the string formatting function (format), but only special functions that come "bundled" in the framework or DBMS adapters will do this in a safe way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question