douchendan0040 2015-02-07 19:04
浏览 29

mysql查询行为奇怪吗?

I have a my sql query

INSERT INTO question (instruction_id, test_id, question,option1,option2,option3,option4,option5,option6,answer) VALUES ('0','1',' निम्न में से कौन सा मीडिया प्रकार सबसे अधिक जानकारी धारित कर सकता है? ','  ब्लू-रे    ',' सीडी    ',' डीवीडी ',' फ्लॉपी डिस्केट   ',' इनमें से कोई नहीं','','2')

I am running it from my application and from phpmyadmin. From my application options are not added everything before option1 and everything after option6 is getting added. But when i am running the query from phpmyadmin its working perfectly. What can be the possible reason for this issue

  • 写回答

1条回答 默认 最新

  • duanji1899 2015-02-07 19:09
    关注

    I believe this is because you are not setting the unicode references correctly in your php page, however phpmyadmin has it set correctly so it handles your characters. Use:

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    

    or set it in php using:

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

    You might also want to check on how to SET NAMES in mysql: query("SET NAMES utf8");

    The basic thing to note is that when you are are working with unicode strings, you have to make sure that every aspect through which that data flows is unicode compliant so that it does not get lost anywhere in the pipeline.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看