日期:2014-05-16 浏览次数:20447 次
<?php
include_once("Conn.php");
$testJSON=array();
$str = trim($_GET['dept']);
$mysql =" select *,0 as ord from checkpro where ifstop=0 and dept like '*".$str."*' ";
echo $mysql;
$rs = $conn->Execute($mysql);
while(!$rs->EOF)
{
$mydept =iconv('gb2312','utf-8',$rs->Fields['dept']->Value);
$mypro =iconv('gb2312','utf-8',$rs->Fields['pro']->Value);
$mynote =iconv('gb2312','utf-8',$rs->Fields['note']->Value);
$mykf =iconv('gb2312','utf-8',$rs->Fields['kf']->Value);
echo $mydept;
$testJSON[] = array('dept'=>"".$mydept."","pro"=>"".$mypro."","note"=>"".$mynote."","kf"=>"".$mykf."");
$rs->MoveNext();
}
foreach ( $testJSON as $key => $value ) {
foreach ( $testJSON[$key] as $key_k => $value_k ) {
$testJSON[$key][$key_k] = urlencode ($value_k);
}
}
echo urldecode ( json_encode ( $testJSON ) );
/*释放资源*/
$rs->Close();
$conn->Close();
$rs = null;
$conn = null;
?>