PHP查询显示SqlServer中的中文
因为工作需要,数据库使用的MS SQL Server2005,而默认的排序规则是SQL_Latin1_General_CP1_CI_AS。创建了一个表,因为需要存储中文信息,Address字段的类型是nvarchar(255)。
此时使用php来连接sql server,页面的编码和文件的编码都是UTF-8,查询此Address字段,显示在页面上是???之类的。怎么解决?
使用
iconv('iso-8859-1','utf-8',$address);
是没有什么用处的。
此时如果SQL一语句中指定字符排序规则为中文再进行转换输出的才是正常的:
$query = 'select Address collate Chinese_PRC_CI_AS from A';
$rs = mssql_query($query,$conn) or die ('Query failed: '.$query);
if ($row = mssql_fetch_array($rs))
{
$address = $row[0];
$address = iconv('GBK','UTF-8',$address);
echo $address;
}
还有其它方法吗?
相关文档:
index.php文件第一行就是包含了
include_once('./common.php');
文件所以先对common.php文件解析
<?php
/*
[UCenter Home] (C) 2007-2008 Comsenz Inc.
$Id: common.php 10981 2009-01-14 03:05:20Z liguode $
*/
//定义一个常量,用来在其他页面中,防止被恶意用户直接调用其他PHP文件。
@def ......
sqlserver:update Table_A set Table_A.col1 = (select Table_B.col1 from Table_B where Table_A.col2 = Table_B.col2)
Access: UPDATE Table_ A, Table_B SET Table_ A.字段2 = Table_ B.字段2
WHERE Table_ A.编号=Table_ A.编号;
自己记下,提醒自己 ......
一、zend studio的配置
1.到zend的安装目录下删除两个文件(可有可无.至少我不删除也不移动可以)
我的安装目录:D:\Program Files\Zend\Zend Studio - 7.0.2\plugins\
删除的文件是:com.zend.php.debug.core_7.0.0.v20090607-1658.jar
&nbs ......
有一个开源项目提供将PHP代码转换成Scala代码的功能,该项目的网站是 http://code.google.com/p/php-to-scala-migration-helper/。
In short, php-to-scala converts PHP code to clean, maintainable Scala source code. To cut to the chase, see ConversionExamples, or the feature-by-feature DesignD ......