开发者

Garbage characters returned when using literals with DB2 SQL and PHP

开发者 https://www.devze.com 2023-03-14 12:57 出处:网络
Statement is similar to this - $sql = \"SELECT foo1, foo2, foo3, fooDate1, fooDate2, \'Open\' FROM some.table\";

Statement is similar to this -

$sql = "SELECT foo1, foo2, foo3, fooDate1, fooDate2, 'Open' FROM some.table";

And I get back in HTML this

1   801566  11451   开发者_Go百科06/21/2011  06/22/2011  ����

I assume this has something to do with character encoding?

Edit:

I found the solution on Zend forums.

"2. Add the following line to Apache configuration file /www/zendsvr/con/httpd.conf : DefaultFsCCSID 37"

Source: http://forums.zend.com/viewtopic.php?f=77&t=8154&p=28348&hilit=db2+ascii#p28348


Try using double quotes:

$sql = "SELECT foo1, foo2, foo3, fooDate1, fooDate2, \"Open\" FROM some.table";
0

精彩评论

暂无评论...
验证码 换一张
取 消