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?

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

报告相同问题?

悬赏问题

  • ¥20 易康econgnition精度验证
  • ¥15 线程问题判断多次进入
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致