title: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'
body: <p>Hi in my sql query i have this error can someone help me how i can fix that?</p>
  
  <p>EDIT: I Added my JavaScript code i think the problem is my JavaScript code because when i use my PHP code directly without sending post method its work as well but with JavaScript i have such problem.</p>
  
  <p>ERROR:</p>
  
  <pre><code>Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like' [1267]
  An sql error occurred while fetching this page. Please contact an administrator if this problem persists
  </code></pre>
  
  <p>TABLE</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `core_members` (
    `member_id` mediumint(8) NOT NULL AUTO_INCREMENT,
    `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
    PRIMARY KEY (`member_id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>    @$key = $_POST['key'];
  
      $result    = $db-&gt;sql_query("SELECT member_id, name FROM core_members WHERE name LIKE '%{$key}%' LIMIT 10");
          while ($row = $db-&gt;sql_fetchrow($result)) {
           ....
          }
  
      $db-&gt;sql_close();
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$('#typeahead').keyup(function() {
      if (this.value.length &lt; 4) return;
      var searchField = $('input.typeahead').val();
      $.ajax({
          type: "POST",
          url: "./_api.php",
          data: 'mod=searchFF&amp;key=%' + searchField,
          success: function(data) {
              $(".tt-suggestions").html(data);
          }
      });
  });
  </code></pre>