dougou2937 2017-01-22 19:21
浏览 39

阵列在Azure上返回空白

Currently trying to do a web service at Azure. Despite tweaking around, the array returned is always blank. There is a response code #3 when I inserted echo to $stmt

<?php
 // Include confi.php
 include_once('confi.php');

 $asset_id = $_GET['asset_id'];
 if(!empty($asset_id)){
 $qur = sqlsrv_query("SELECT asset_name,operating_system ,serial_no ,asset_status FROM [dbo].[assets] WHERE [asset_id]='".$asset_id."'");
 $stmt = sqlsrv_query( $conn, $qur);
 $result =array();

 while($row = sqlsrv_fetch_array($stmt)){
 //extract($row);
 $result[] = array('asset_name' => $row["asset_name"], 'operating_system' => $row["operating_system"], 'serial_no' => $row["serial_no"], 'asset_status' => $row["asset_status"]); 
 }
 $json = "info" => $result;
 }else{
 $json = array("msg" => "Asset not found");
 }
 @sqlsrv_close($conn);

 /* Output header */
 header('Content-type: application/json');
 echo json_encode($json);

This is the result:

[[]]
  • 写回答

0条回答 默认 最新

      编辑
      预览

      报告相同问题?

      手机看
      程序员都在用的中文IT技术交流社区

      程序员都在用的中文IT技术交流社区

      专业的中文 IT 技术社区,与千万技术人共成长

      专业的中文 IT 技术社区,与千万技术人共成长

      关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

      关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

      客服 返回
      顶部