title: How to select the substring of a filename in MySQL?
body: <p>I'm doing an autocomplete to find files matching a search parameter entered in a form. If someone enters &quot;p&quot; it returns ALL pdf files, which I don't want. I only want them to search the name of the file. Here's my query...</p>
  <pre><code>SELECT uid, link_text 
  FROM tblProfile 
  WHERE link_text LIKE &quot;%'. $text . '%&quot;
  ORDER BY link_text
  LIMIT 8
  </code></pre>
  <p>I tried to do...</p>
  <pre><code>SELECT SUBSTRING(link_text,-4,4)
  FROM tblProfile
  WHERE SUBSTRING(link_text,-4,4) like &quot;%'. $text . '%&quot;
  </code></pre>
  <p>But it didn't work. I could create a new column in the table to store the name w/out the extension but there has to be a better way!</p>