dongsu4345 2019-01-09 18:21
浏览 21
已采纳

SQL-Server选择在PHP上返回null

I have a query that returns all the data while running at MSSQL, but when I try to get the result with php code it returns null

SELECT:

   $query =  "SELECT  DISTINCT (E080SER.desser) as desser,
                E080SER.CODFAM codfam, e085cli.apecli apecli, 
                E085CLI.CODCLI codcli, E085CLI.NOMCLI nomeCli
                FROM
                E160CTR,
                E160CVS, e080ser,
                E085CLI,
                E070EMP,
                E070FIL
                WHERE
                e070emp.nomemp like '%Gestão tech%' and 
                e080ser.codser = e160cvs.codser and
                e080ser.codser like ('%manw%') and (E160CTR.CODEMP = 1)  and
                ((E160CTR.CODEMP = E070FIL.CODEMP) AND (E160CTR.CODFIL = 
                E070FIL.CODFIL) AND  
                (E160CTR.CODCLI = E085CLI.CODCLI) AND (E160CVS.CODEMP = 
                E160CTR.CODEMP) AND 
                (E160CVS.CODFIL = E160CTR.CODFIL) AND (E160CVS.NUMCTR = 
                E160CTR.NUMCTR)) AND
                (E160CTR.SITCTR = 'A') and e080ser.sitser = 'a' and 
                E080SER.CODEMP IN (1, 9)
                  order by e080ser.desser";

PHP CODE:

 $sql = sqlsrv_query($conn, $query);
 while($item = sqlsrv_fetch_array($sql)){
    var_dump($item);
}
  • 写回答

3条回答 默认 最新

  • duanguan1573 2019-01-09 20:13
    关注

    I've found the problem

    The problem was the encoding, I put the $query inside of utf8_encode(), and now it is returning the results.

    Thank you all for your time.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀