A
A
Alexey Aleksin2016-08-29 05:44:21
PHP
Alexey Aleksin, 2016-08-29 05:44:21

How to improve the search function?

Good afternoon everyone, I'm doing a small simple live search, in the input for searching after entering two characters, a script works that displays everything found in the following image:

$db_referal = $mysqli -> query("SELECT name FROM product WHERE name LIKE'%$referal%'");

As a result, it gives out the entire line containing the search word.
while ($row = $db_referal -> fetch_array()) {
        echo "\n<li>".$row["name"]."</li>";
    }

How to make it so that it does not output the entire line, but only the word? The search goes on one field, one table (as you can see from my query), and the field contains a sentence. And from the sentence it is necessary to extract exactly the word that satisfies the desired result.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2016-08-29
@leroyleroy

you already have the word (from the search bar).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question