query($sql); $rowset = $result->fetchAll(PDO::FETCH_ASSOC); var_dump($pdo->errorInfo()); var_dump($rowset); $linker_count=isset($rowset[0]["LINKER_COUNT"])?$rowset[0]["LINKER_COUNT"]:0; $data=array( "code"=>$rowset[0]["ERRCODE"], "info"=>$rowset[0]["ERRINFO"] ); if ($linker_count >0){ foreach ($rowset as $v){ $val=array(); $val["customer_id"]=$v["ID"]; $val["customer_name"]=$v["CUSTOMER_NAME"]; $val["customer_mobile"]=$v["CUSTOMER_MOBILE"]; $val["customer_idtype"]=$v["CUSTOMER_ID_TYPE"]; $val["customer_idno"]=$v["CUSTOMER_ID_NO"]; $data["order_list"][]=$val; } } echo json_encode($data);