douliang2087 2013-11-25 07:20
浏览 37
已采纳

使用希伯来语时,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.

  • 写回答

2条回答 默认 最新

  • dongyou2714 2013-11-25 07:31
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog