Search words by similarity in MySQL query
<p>So I have this MySQL query:</p>

<pre><code>$search = $_POST['search'];
$SQL = "SELECT * FROM `data` WHERE name='$search';
$rs = mysqli_query($dbconfig, $SQL);
</code></pre>

<p>I use this code to search data into the database, with the word that has been submitted by the form. The problem is, the query only shows up results if the search word matches the data in the database.</p>

<p>For example, if I have a file named <code>advertisement.png</code> and I search for this file, it will only show up if I search for the exact same word.</p>

<p>If I search for <code>advertisement.png</code> it will show <code>advertisement.png</code>, but if I search for <code>advertisement</code> it will not show up. What I want, is to search data that are similar to the key word provided in the form. </p>

<p>So if I search<code>"advert"</code> it shows up results that are similar to this word.</p>

<p>Thanks in advance.</p>