×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

apache/php/Mysql 问题求教专家

1)怎样才能在PHP code 中显示汉字? in my httpd.conf, I setup the config like this:
AddDefaultCharset GB2312, should I config the php.ini to user mbstring ?
2)in talking with mysql (charset=uft-8), how can I convert the php variable to match with the mysql charset (e.g below:)
<?php
$name=' 正文';
$sql=" select * from some_tab where name=\'".$name."\'";
$sql= stripslashes($sql);
...
//talk to database, problem is mysql my not recognize the ' 正文'
...
?>

Thanks in advance!
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / apache/php/Mysql 问题求教专家
    1)怎样才能在PHP code 中显示汉字? in my httpd.conf, I setup the config like this:
    AddDefaultCharset GB2312, should I config the php.ini to user mbstring ?
    2)in talking with mysql (charset=uft-8), how can I convert the php variable to match with the mysql charset (e.g below:)
    <?php
    $name=' 正文';
    $sql=" select * from some_tab where name=\'".$name."\'";
    $sql= stripslashes($sql);
    ...
    //talk to database, problem is mysql my not recognize the ' 正文'
    ...
    ?>

    Thanks in advance!
    • 偏方:安装myadmin(mysql的web/perl版本admin)。insert或查询汉字,如果成功,查看sql语句的写法。 我觉得是你quote的用法有问题,但不确定。
      • 谢谢了, 我会试试!
      • my quote 对英语没问题, 只是对汉字不灵,估计与unicode 转换有关...
        • php/mysql使用中文肯定没问题(BUG除外),我在全英文环境(server端)下用过。