Home > Backend Development > PHP Tutorial > php 读取 mssql 里的空值 怎么判断

php 读取 mssql 里的空值 怎么判断

WBOY
Release: 2016-06-13 13:40:51
Original
962 people have browsed it

php 读取 mssql 里的空值 如何判断?
环境为: linux redhat 5.4 ,php+freetds+mssql 2005 server



//*****************************************************

$value=iconv("GB2312","UTF-8",$row[iconv("UTF-8","GB2312",$field)]);
echo "

"; // 如果$field 字段在 mssql 2005 为null 值时 ,下面的句话不执行
echo $value;// 如果$field 字段在 mssql 2005 为null 值时 ,下面的句话不执行

echo ""// 如果$field 字段在 mssql 2005 为null 值时 ,下面的句话不执行




//****************************
echo "
";
//echo "waredatememo:".$test["waredatememo"] ;
echo "
";
echo iconv("GB2312","UTF-8",$row[iconv("UTF-8","GB2312",$field)]) or die("MSG results:".mssql_get_last_message());

其中$field 字段时 mssql 2005 中是 null 值。

用上面的语句测试时,web 页只显示:"MSG results:" 后面没有任何消息!

求解!....

------解决方案--------------------
查询出结果后用empty判断!因为结果是数组,你没法直接用==''或者==0来判断
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