使用希伯来语时,PHP就像查询找不到任何结果

I hope its allowed and i am not bothering here every 5 minutes with new questions but i need help at this .

I have this code , i got it from my last question before :

          $string = $purifier->purify(@$_POST['string']); 

          $query = "SELECT * FROM users WHERE user_fname like '%".$string."%' OR user_lname like '%".$string."%' OR username like  '%".$string."%' OR useremail like '%".$string."%'";
          mysql_query("SET NAMES 'utf8'");
          $result2 = mysql_query($query);
          $num = mysql_num_rows($result2);

          if($num == 1)
          {
             // return foreach with all results similar to the word thet write on the input.
          }else
          {
             // return wrong . no reuslts found
          }

This way working perfect with English words , when i using Hebrew words its not find nothing .

I did die to $string ,and the word was perfecly writed in hebrew and on utf8 , all my database using utf8_general_ci , all my pages have meta with utf8 encoding , all my site working perfect with hebrew .

But here with this code when i try to search like somthing in Database with hebrew words always says not found , when i try in english its found , any idea ?

Thanks a lot.

Your page, probably, isn't encoded in UTF-8.

If it was, when you printed the message you shouldn't see the Hebrew characters (unless you set header('Content-type: text/html; charset=utf-8'); before

(If the page is utf-8 encoded and you don't have this header, or other with charset=utf-8 - you would get black rhombus signs with question marks).

If order to encode it in UTF-8 you can open it with Notapad++ and select:

Encoding -> Encode in UTF-8 Without BOM

Try this : first set your page to utf-8

  header('Content-type: text/html; charset=utf-8');

Also You need to do this

 mysql_query("ALTER DATABASE <mydatabasename>
 DEFAULT CHARACTER SET utf8
 DEFAULT COLLATE utf8_general_ci");
$query = "SELECT * FROM users WHERE user_fname like '%".$string."%' OR user_lname like        '%".$string."%' OR username like  '%".$string."%' OR useremail like '%".$string."%'";

Note: You can alter your table also for COLLATE and CHARACTER SET.