title: mysql like to match complete word or beginning of word on string
body: <p>Given a search string I need to select every record where (in the field the search is performed on) there is at least one word that begins with the given text.</p>
  
  <p>For example:</p>
  
  <pre><code>'John Doe'
  </code></pre>
  
  <p>Have to be be selected with search strings like:</p>
  
  <pre><code>'joh'
  'do'
  'JOHN doe'
  </code></pre>
  
  <p>Have <strong>not</strong> to be selected with</p>
  
  <pre><code>'ohn'
  'oe'
  </code></pre>
  
  <p>I need (possibly) to avoid full text search.</p>
  
  <p>What I've found to work is</p>
  
  <pre><code>$query = 'SELECT * FROM MYTABLE WHERE SEARCHFIELD LIKE "' . $searchText . '%"'
                                  . 'OR SEARCHFIELD LIKE "% ' . $searchText . '%"'
  </code></pre>
  
  <p>I'm asking if there is a better way to do that.</p>
  
  <p>(for "better way" I mean <em>better performance</em> or <em>same performance but more elegant</em>)</p>
  
  <p>Also, as the query will be built up with a prepared statement, how should I unescape <strong>LIKE</strong> metacharacters in the search string?</p>