duanmu5641 2015-09-15 08:27
浏览 66
已采纳

PHPStorm有时只对查询进行查询

So i got this query in my File if i run the code

$query = "SELECT * FROM dbo.V_Admin_Hülse ORDER BY Kaliber DESC"; 
$sql = $conn->query($query);

this is $conn it is in a diffrent file but required:

$conn = new PDO("sqlsrv:server=$serverName;Database = $database;", $uid, $pwd);
$conn->setAttribute(PDO::SQLSRV_ATTR_ENCODING, PDO::SQLSRV_ENCODING_UTF8);

if i run the file in debug and look into $query it reads:

$query = SELECT * FROM dbo.V_Admin_Hülse ORDER BY Kaliber DESC

And there is no problem running it. In a different file i got another Statment with an umlaut

$query = "SELECT * FROM dbo.T_Geschossform ORDER BY Abkürzung ASC";
$sql = $conn->query($query);

but when i run that in Debug i get

 $query = SELECT * FROM dbo.T_Geschossform ORDER BY Abkürzung ASC

and quits with an exception!

Why is that? And how do i get it to do it properly?

  • 写回答

1条回答 默认 最新

  • dongxin8709 2015-09-15 09:12
    关注

    Ok i added

    header('Content-Type: text/html; charset=utf-8');

    and after i closed and reopend the Projekt it read

    $query = "SELECT * FROM dbo.T_Geschossform ORDER BY Abk�rzung ASC"
    

    i replaced the � with an ü and now it works fine....

    Strange things are happening... Can anyone explain?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条
  • ¥15 Python报错怎么解决
  • ¥15 simulink如何调用DLL文件
  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了