PDO读oracle中文查询有关问题

WBOY
Release: 2016-06-13 12:02:39
Original
1229 people have browsed it

PDO读oracle中文查询问题
本人对数据库基本小白,PHP也是新手。现在用PDO远程访问oracle数据库时,表头是中文的,查询时就不出结果。比如$sql=select * from aaa where 站号= 1234 ;  返回是undefined index ......
求解。。。谢谢各位
------解决方案--------------------
你的 dsn 是怎么写的?
new PDO('oci:dbname=//服务器名或ip:1521/实例名;charset=zhs16gbk', '用户名', '口令');
这个一定要有
因为你的字段名是中文的,所以字符集一定不能搞错
你若需要页面是 utf-8 的,那么只能读取后转码了
如果将中文字段名改成西文的,那么倒是可以改变 charset 来获取相应编码的数据

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template