Home >Backend Development >PHP Tutorial >php通过odbc用sql语句查询时无法查询中文,应该怎么转码?

php通过odbc用sql语句查询时无法查询中文,应该怎么转码?

WBOY
WBOYOriginal
2016-06-02 11:34:561780browse

phpsql乱码informix

数据库是informix,编码是iso-8859-1,php编码是gbk。从网上找了各种方式转换,都不行。
代码如下,其中$licenseno是车牌号,中间有省份缩写是汉字。

<code>$sql.="and b.licenseno = \"".$licenseno."\"";</code>

会返回错误如下:

<code>Warning: odbc_exec() [function.odbc-exec]: SQL error: [Informix][Informix ODBC Driver]Inexact character conversion during translation., SQL state S1000 in SQLExecDirect in D:\wamp\www\chaxun\chaxun.php on line 79</code>

请问应该怎么做?谢谢

Statement:
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