douye1876 2013-11-15 15:38
浏览 50
已采纳

转换表ascii php中的特殊字符

I want to make a search the database, where the user will type the word you want to search, a query is made, and if the word is found it shows the result.

Let's imagine that you want to search used the word "líder". In the database, I have the word "líder" saved as "l& iacute;der".

To search'm doing the following query:

$search = htmlentities($search_user);
$result = mysql_query("SELECT * FROM paginas WHERE content like '%$search%'");

the query says it found no results.

have also experimented with htmlspecialchars and my database is utf8_general_ci as well.

  • 写回答

2条回答 默认 最新

  • du8442 2013-11-15 18:48
    关注

    problem resolved:

    $search = htmlentities($search_user, ENT_QUOTES, 'UTF-8');
    

    thanks!

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

报告相同问题?

悬赏问题

  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 51寻迹小车定点寻迹
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站
  • ¥15 滑块验证码移动速度不一致问题
  • ¥15 Utunbu中vscode下cern root工作台中写的程序root的头文件无法包含